Skip to content

Commit 10b807d

Browse files
committed
Updated API from documentation release
1 parent 51294d9 commit 10b807d

17 files changed

+213
-19
lines changed

api-specs/api/examples/Customer/CustomerToken.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
},
1313
"customerId": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24",
1414
"expiresAt": "2022-09-19T15:58:41.772Z",
15-
"value": "Is5gdF7Ym-Aick-AkmsEHMMBWpByIfjgyXxKxZem"
15+
"value": "Is5gdF7Ym-Aick-AkmsEHMMBWpByIfjgyXxKxZem",
16+
"invalidateOlderTokens": true
1617
}

api-specs/api/resources/customers.raml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ post:
5858
body:
5959
application/json:
6060
example: !include ../examples/customer.example.json
61+
400:
62+
description: An [ExpiredCustomerPasswordToken](ctp:api:type:ExpiredCustomerPasswordTokenError) error is returned as the provided token has expired.
63+
404:
64+
description: The provided token is invalid or does not exist.
6165
/email-token={emailToken}:
6266
(methodName): withEmailToken
6367
type:
@@ -74,6 +78,10 @@ post:
7478
body:
7579
application/json:
7680
example: !include ../examples/customer.example.json
81+
400:
82+
description: An [ExpiredCustomerEmailToken](ctp:api:type:ExpiredCustomerEmailTokenError) error is returned as the provided token has expired.
83+
404:
84+
description: The provided token is invalid or does not exist.
7785
/email-token:
7886
type: base
7987
post:
@@ -83,6 +91,7 @@ post:
8391
Use this method to create an email token for a global Customer during their [email verification process](/../api/customers-overview#customer-email-verification).
8492
8593
Creating an email token for the Customer produces the [CustomerEmailTokenCreated](ctp:api:type:CustomerEmailTokenCreatedMessage) Message.
94+
The Message will include the token's value, if the token's validity is 60 minutes or less.
8695
body:
8796
application/json:
8897
example: !include ../examples/Customer/CustomerCreateEmailToken.json
@@ -100,6 +109,8 @@ post:
100109
Use this method to verify a global Customer's email during their [email verification process](/../api/customers-overview#customer-email-verification).
101110
102111
Verifying the email of the Customer produces the [CustomerEmailVerified](ctp:api:type:CustomerEmailVerifiedMessage) Message.
112+
113+
After the email is verified, all email tokens issued previously through the [email verification flow](/../api/projects/customers#email-verification-of-customer) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
103114
securedBy: [oauth_2_0: { scopes: ['manage_customers:{projectKey}'] }]
104115
body:
105116
application/json:
@@ -112,6 +123,10 @@ post:
112123
application/json:
113124
example: !include ../examples/customer.example.json
114125
type: Customer
126+
400:
127+
description: An [ExpiredCustomerEmailToken](ctp:api:type:ExpiredCustomerEmailToken) error is returned as the provided token is has expired.
128+
404:
129+
description: The provided token is invalid or does not exist.
115130
/password:
116131
type: base
117132
post:
@@ -136,9 +151,9 @@ post:
136151
description: |
137152
Use this method to reset a global Customer's password during their [password reset process](/../api/customers-overview#customer-password-reset).
138153
139-
After the password is reset, any previously issued access and/or refresh tokens created through the [password flow](/authorization#password-flow) or [refresh token flow](/authorization#refresh-token-flow) are invalidated.
140-
141154
Resetting the password of the Customer produces the [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=true`.
155+
156+
After the password is reset, all password tokens issued previously through the [password reset flow](/../api/projects/customers#password-reset-of-customer) are invalidated. In addition, any access and refresh tokens issued previously through the [password flow](/../api/authorization#password-flow) and [refresh token flow](/../api/authorization#refresh-token-flow) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
142157
securedBy: [oauth_2_0: { scopes: ['manage_customers:{projectKey}'] }]
143158
body:
144159
application/json:
@@ -150,6 +165,10 @@ post:
150165
application/json:
151166
example: !include ../examples/customer.example.json
152167
type: Customer
168+
400:
169+
description: An [ExpiredCustomerPasswordToken](ctp:api:type:ExpiredCustomerPasswordTokenError) error is returned as the provided token has expired.
170+
404:
171+
description: The provided token is invalid or does not exist.
153172
/password-token:
154173
type: base
155174
description: Produces the [CustomerPasswordTokenCreated](ctp:api:type:CustomerPasswordTokenCreatedMessage) Message.
@@ -159,7 +178,8 @@ post:
159178
description: |
160179
Use this method to create a password reset token for a global Customer during their [password reset process](/../api/customers-overview#customer-password-reset).
161180
162-
Creating a password reset token does not invalidate existing tokens.
181+
Creating a password reset token for the Customer produces the [CustomerPasswordTokenCreated](ctp:api:type:CustomerPasswordTokenCreatedMessage) Message.
182+
The Message will include the token's value, if the token's validity is 60 minutes or less.
163183
body:
164184
application/json:
165185
example: !include ../examples/Customer/CustomerCreatePasswordResetToken.json

api-specs/api/resources/in-store.raml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,11 +1600,12 @@ uriParameters:
16001600
description: |
16011601
This is the last step in the [email verification process of a Customer](/../api/projects/customers#email-verification-of-customer-in-store). Returns a `200 OK` status if successful.
16021602
1603+
After the email is verified, all email tokens issued previously through the [email verification flow](/../api/projects/customers#email-verification-of-customer) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
1604+
16031605
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
16041606
16051607
- If no Customer exists with the `id` specified in the [customer:{id}](/scopes#composable-commerce-oauth) scope.
16061608
- If the Customer exists but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
1607-
16081609
securedBy:
16091610
[
16101611
oauth_2_0:
@@ -1628,6 +1629,10 @@ uriParameters:
16281629
application/json:
16291630
example: !include ../examples/customer.example.json
16301631
type: Customer
1632+
400:
1633+
description: An [ExpiredCustomerEmailToken](ctp:api:type:ExpiredCustomerEmailToken) error is returned as the provided token is has expired.
1634+
404:
1635+
description: The provided token is invalid or does not exist.
16311636
/password:
16321637
type: base
16331638
post:
@@ -1673,11 +1678,12 @@ uriParameters:
16731678
16741679
Resetting a password produces the Customer [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=true`.
16751680
1681+
After the password is reset, all password tokens issued previously through the [password reset flow](/../api/projects/customers#password-reset-of-customer) are invalidated. In addition, any access and refresh tokens issued previously through the [password flow](/../api/authorization#password-flow) and [refresh token flow](/../api/authorization#refresh-token-flow) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
1682+
16761683
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
16771684
16781685
- If no Customer exists with the `id` specified in the [customer:{id}](/scopes#composable-commerce-oauth) scope.
16791686
- If the Customer exists but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
1680-
16811687
securedBy:
16821688
[
16831689
oauth_2_0:
@@ -1700,6 +1706,10 @@ uriParameters:
17001706
application/json:
17011707
example: !include ../examples/customer.example.json
17021708
type: Customer
1709+
400:
1710+
description: An [ExpiredCustomerPasswordToken](ctp:api:type:ExpiredCustomerPasswordTokenError) error is returned as the provided token has expired.
1711+
404:
1712+
description: The provided token is invalid or does not exist.
17031713
/signup:
17041714
type: base
17051715
post:
@@ -1857,6 +1867,10 @@ uriParameters:
18571867
body:
18581868
application/json:
18591869
example: !include ../examples/customer.example.json
1870+
400:
1871+
description: An [ExpiredCustomerPasswordToken](ctp:api:type:ExpiredCustomerPasswordTokenError) error is returned as the provided token has expired.
1872+
404:
1873+
description: The provided token is invalid or does not exist.
18601874
/email-token={emailToken}:
18611875
(methodName): withEmailToken
18621876
type:
@@ -1879,6 +1893,10 @@ uriParameters:
18791893
body:
18801894
application/json:
18811895
example: !include ../examples/customer.example.json
1896+
400:
1897+
description: An [ExpiredCustomerEmailToken](ctp:api:type:ExpiredCustomerEmailTokenError) error is returned as the provided token has expired.
1898+
404:
1899+
description: The provided token is invalid or does not exist.
18821900
/email-token:
18831901
type: base
18841902
post:
@@ -1887,6 +1905,9 @@ uriParameters:
18871905
Use this method to create an email token for a Store-specific Customer during their [email verification process](/../api/customers-overview#customer-email-verification).
18881906
18891907
If the Customer exists in the Project but the `stores` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
1908+
1909+
Creating an email token for the Customer produces the [CustomerEmailTokenCreated](ctp:api:type:CustomerEmailTokenCreatedMessage) Message.
1910+
The Message will include the token's value, if the token's validity is 60 minutes or less.
18901911
securedBy:
18911912
- oauth_2_0:
18921913
scopes:
@@ -1911,6 +1932,8 @@ uriParameters:
19111932
Verifying the email of the Customer produces the [CustomerEmailVerified](ctp:api:type:CustomerEmailVerifiedMessage) Message.
19121933
19131934
If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
1935+
1936+
After the email is verified, all email tokens issued previously through the [email verification flow](/../api/projects/customers#email-verification-of-customer) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
19141937
securedBy:
19151938
- oauth_2_0:
19161939
scopes:
@@ -1927,6 +1950,10 @@ uriParameters:
19271950
application/json:
19281951
example: !include ../examples/customer.example.json
19291952
type: Customer
1953+
400:
1954+
description: An [ExpiredCustomerEmailToken](ctp:api:type:ExpiredCustomerEmailTokenError) error is returned as the provided token has expired.
1955+
404:
1956+
description: The provided token is invalid or does not exist.
19301957
/password:
19311958
type: base
19321959
post:
@@ -1955,12 +1982,11 @@ uriParameters:
19551982
description: |
19561983
Use this method to reset a Store-specific Customer's password during their [password reset process](/../api/customers-overview#customer-password-reset).
19571984
1958-
After the password is reset, any previously issued access and/or refresh tokens created through the [password flow](/authorization#password-flow) or [refresh token flow](/authorization#refresh-token-flow) are invalidated.
1959-
19601985
Resetting the password of the Customer produces the [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=true`.
19611986
1962-
If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), then this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
1987+
After the password is reset, all password tokens issued previously through the [password reset flow](/../api/projects/customers#password-reset-of-customer) are invalidated. In addition, any access and refresh tokens issued previously through the [password flow](/../api/authorization#password-flow) and [refresh token flow](/../api/authorization#refresh-token-flow) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
19631988
1989+
If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), then this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
19641990
securedBy:
19651991
- oauth_2_0:
19661992
scopes:
@@ -1976,16 +2002,21 @@ uriParameters:
19762002
application/json:
19772003
example: !include ../examples/customer.example.json
19782004
type: Customer
2005+
400:
2006+
description: An [ExpiredCustomerPasswordToken](ctp:api:type:ExpiredCustomerPasswordTokenError) error is returned as the provided token has expired.
2007+
404:
2008+
description: The provided token is invalid or does not exist.
19792009
/password-token:
19802010
type: base
19812011
post:
19822012
displayName: Create password reset token for Customer in Store
19832013
description: |
19842014
Use this method to create a password reset token for a Store-specific Customer during their [password reset process](/../api/customers-overview#customer-password-reset).
19852015
1986-
Creating a password reset token does not invalidate existing tokens.
1987-
19882016
If the Customer exists in the Project but the `stores` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
2017+
2018+
Creating a password reset token for the Customer produces the [CustomerPasswordTokenCreated](ctp:api:type:CustomerPasswordTokenCreatedMessage) Message.
2019+
The Message will include the token's value, if the token's validity is 60 minutes or less.
19892020
securedBy:
19902021
- oauth_2_0:
19912022
scopes:

api-specs/api/resources/me.raml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ delete:
6868
displayName: Verify email of My Customer
6969
description: |
7070
This is the last step in the [email verification process of a Customer](/../api/projects/customers#email-verification-of-customer).
71+
72+
After the email is verified, all email tokens issued previously through the [email verification flow](/../api/projects/customers#email-verification-of-customer) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
7173
securedBy:
7274
[
7375
oauth_2_0:
@@ -84,6 +86,10 @@ delete:
8486
application/json:
8587
example: !include ../examples/customer.example.json
8688
type: Customer
89+
400:
90+
description: An [ExpiredCustomerEmailToken](ctp:api:type:ExpiredCustomerEmailToken) error is returned as the provided token is has expired.
91+
404:
92+
description: The provided token is invalid or does not exist.
8793
/password:
8894
type: base
8995
post:
@@ -117,6 +123,8 @@ delete:
117123
This is the last step in the [password reset process of a Customer](/../api/projects/customers#password-reset-of-customer).
118124
119125
Resetting a password of the Customer produces the [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=true`.
126+
127+
After the password is reset, all password tokens issued previously through the [password reset flow](/../api/projects/customers#password-reset-of-customer) are invalidated. In addition, any access and refresh tokens issued previously through the [password flow](/../api/authorization#password-flow) and [refresh token flow](/../api/authorization#refresh-token-flow) are invalidated. This invalidation of tokens is [eventually consistent](/../api/general-concepts#eventual-consistency).
120128
securedBy:
121129
[
122130
oauth_2_0:
@@ -132,6 +140,10 @@ delete:
132140
application/json:
133141
example: !include ../examples/customer.example.json
134142
type: Customer
143+
400:
144+
description: An [ExpiredCustomerPasswordToken](ctp:api:type:ExpiredCustomerPasswordTokenError) error is returned as the provided token has expired.
145+
404:
146+
description: The provided token is invalid or does not exist.
135147
/signup:
136148
type: base
137149
post:

api-specs/api/types/customer/CustomerCreateEmailToken.raml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ properties:
1515
type: number
1616
format: int64
1717
description: Validity period of the generated token in minutes.
18+
invalidateOlderTokens?:
19+
type: boolean
20+
default: false
21+
description: |
22+
If set to `true`, all email tokens issued previously for the Customer will be invalidated.

api-specs/api/types/customer/CustomerCreatePasswordResetToken.raml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ properties:
1313
format: int64
1414
description: |
1515
Validity period of the generated token in minutes.
16-
default: 34560
16+
default: 1440
17+
invalidateOlderTokens?:
18+
type: boolean
19+
default: false
20+
description: |
21+
If set to `true`, all password tokens issued previously for the Customer will be invalidated.

api-specs/api/types/customer/CustomerToken.raml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ properties:
2020
type: datetime
2121
description: |
2222
Date and time (UTC) the token expires.
23+
invalidateOlderTokens:
24+
type: boolean
25+
description: |
26+
If `true`, all tokens issued previously for the Customer will be invalidated.
2327
createdAt:
2428
type: datetime
2529
description: |
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#%RAML 1.0 DataType
2+
(package): Error
3+
type: ErrorObject
4+
displayName: ExpiredCustomerEmailTokenError
5+
discriminatorValue: ExpiredCustomerEmailToken
6+
description: |
7+
Returned when the provided email token of the Customer has expired.
8+
9+
The error is returned as a failed response to:
10+
11+
- [Get Customer by email token](ctp:api:endpoint:/{projectKey}/customers/email-token={emailToken}:GET) and [Get Customer in Store by email token](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/email-token={emailToken}:GET) requests
12+
- [Verify email of Customer](ctp:api:endpoint:/{projectKey}/customers/email/confirm:POST) and [Verify email of Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/email/confirm:POST) requests
13+
properties:
14+
code:
15+
type: string
16+
message:
17+
type: string
18+
description: |
19+
`"The given email token has expired."`
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#%RAML 1.0 DataType
2+
(package): Error
3+
type: ErrorObject
4+
displayName: ExpiredCustomerPasswordTokenError
5+
discriminatorValue: ExpiredCustomerPasswordToken
6+
description: |
7+
Returned when the provided password token of the Customer has expired.
8+
9+
The error is returned as a failed response to:
10+
11+
- [Get Customer by password token](ctp:api:endpoint:/{projectKey}/customers/password-token={passwordToken}:GET) and [Get Customer in Store by password token](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password-token={passwordToken}:GET) requests
12+
- [Reset password of Customer](ctp:api:endpoint:/{projectKey}/customers/password/reset:POST) and [Reset password of Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password/reset:POST) requests
13+
properties:
14+
code:
15+
type: string
16+
message:
17+
type: string
18+
description: |
19+
`"The given password token has expired."`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#%RAML 1.0 DataType
2+
(package): Error
3+
type: GraphQLErrorObject
4+
displayName: GraphQLExpiredCustomerEmailTokenError
5+
discriminatorValue: ExpiredCustomerEmailToken
6+
description: |
7+
Returned when the provided email token of the Customer has expired.
8+
9+
The error is returned as a failed response to:
10+
11+
- [Get Customer by email token](ctp:api:endpoint:/{projectKey}/customers/email-token={emailToken}:GET) and [Get Customer in Store by email token](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/email-token={emailToken}:GET) requests
12+
- [Verify email of Customer](ctp:api:endpoint:/{projectKey}/customers/email/confirm:POST) and [Verify email of Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/email/confirm:POST) requests
13+
properties:
14+
code:
15+
type: string

0 commit comments

Comments
 (0)