-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,583 additions
and
10 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
apis/product/shopper-products/Traits/GetProductBadRequest.raml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#%RAML 1.0 Trait | ||
description: This trait represents API behavior for a 400 response. | ||
responses: | ||
400: | ||
description: Bad Request. | ||
body: | ||
application/problem+json: | ||
type: ErrorResponse | ||
examples: | ||
BadRequest: | | ||
{ | ||
"title": "Bad Request", | ||
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/validation", | ||
"detail": "Maximum number of products you can request in one call is 25." | ||
} | ||
MalformedSelector: | | ||
{ | ||
"title": "Malformed Selector", | ||
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/malformed-selector", | ||
"detail": "The property selector '(brand,imageGroups.(**)' is malformed.", | ||
"selector": "(brand,imageGroups.(**)" | ||
} | ||
FilterExpressionBadRequest: | | ||
{ | ||
"title": "Bad Request", | ||
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/bad-request", | ||
"detail": "Filter expressions in select are not supported.", | ||
"parameter": "Filter expressions in select are not supported.", | ||
"selector": "(recommendations[?(recommendedItemId=='apple-ipod-nano'].(**))" | ||
} |
24 changes: 24 additions & 0 deletions
24
apis/product/shopper-products/Traits/GetProductsBadRequest.raml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#%RAML 1.0 Trait | ||
description: This trait represents API behavior for a 400 response. | ||
responses: | ||
400: | ||
description: Bad Request. | ||
body: | ||
application/problem+json: | ||
type: ErrorResponse | ||
examples: | ||
MalformedSelectorGetProducts: | | ||
{ | ||
"title": "Malformed Selector", | ||
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/malformed-selector", | ||
"detail": "The property selector '(data.(name, imageGroups.(**))' is malformed.", | ||
"selector": "(data.(name, imageGroups.(**))" | ||
} | ||
FilterExpressionBadRequestGetProducts: | | ||
{ | ||
"title": "Bad Request", | ||
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/bad-request", | ||
"detail": "Filter expressions in select are not supported.", | ||
"parameter": "Filter expressions in select are not supported.", | ||
"selector": "(data[?(brand=='abc')].(**))" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"main":"shopper-products.raml","name":"Shopper Products","classifier":"raml","tags":[],"groupId":"893f605e-10e2-423a-bdb4-f952f56eb6d8","backwardsCompatible":false,"assetId":"shopper-products","version":"0.0.24","apiVersion":"v1","dependencies":[{"groupId":"893f605e-10e2-423a-bdb4-f952f56eb6d8","assetId":"commerce-cloud-standards","version":"1.0.24"},{"groupId":"893f605e-10e2-423a-bdb4-f952f56eb6d8","assetId":"api-standards","version":"1.1.15"}],"originalFormatVersion":"1.0"} | ||
{"main":"shopper-products.raml","name":"Shopper Products","classifier":"raml","tags":[],"groupId":"893f605e-10e2-423a-bdb4-f952f56eb6d8","backwardsCompatible":false,"assetId":"shopper-products","version":"0.0.25","apiVersion":"v1","dependencies":[{"groupId":"893f605e-10e2-423a-bdb4-f952f56eb6d8","assetId":"api-standards","version":"1.1.15"},{"groupId":"893f605e-10e2-423a-bdb4-f952f56eb6d8","assetId":"commerce-cloud-standards","version":"1.0.27"}],"originalFormatVersion":"1.0","organizationId":"893f605e-10e2-423a-bdb4-f952f56eb6d8"} |
37 changes: 37 additions & 0 deletions
37
...bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Documentation/ErrorResponseMapping.raml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#%RAML 1.0 DocumentationItem | ||
title: Error Response Mapping from OCAPI to Mulesoft | ||
|
||
content: |- | ||
# NOTE: this documentation does not belong here any may be moved in the future. | ||
- ErrorResponse defined in [API Standards RAML library](https://anypoint.mulesoft.com/exchange/893f605e-10e2-423a-bdb4-f952f56eb6d8/api-standards/) *MUST* be used in case of error. Teams MAY derive their own error response types from ErrorResponse. | ||
- ErrorResponse.type *MUST* be unique CommerceCloud-wide. This is an unequivocal identification of the error and therefore should be unique. | ||
- Work to write a common data weave that will transform the OCAPI Fault to [RFC 7807](https://tools.ietf.org/html/rfc7807) compliant messages | ||
- Content-Type: `application/problem+json` | ||
- `type`: URI in the format of https://api.commercecloud.salesforce.com/documentation/error/v1/errors/<kebab-case-`fault.type`>, with the word “Exception” removed from the last segment. | ||
- `title`: the `fault.type`, Upper Space Case, with the word “Exception” removed. | ||
- `detail`: the content of fault.message | ||
- Any attributes in `fault.arguments` just map to extra attributes of the same name, following all camelCase conventions. | ||
## Example Mapping: | ||
### OCAPI Fault Response | ||
{ | ||
"_v" : "20.2", | ||
"fault": { | ||
"arguments": { | ||
"target_cartridge": "core" | ||
}, | ||
"type": "InvalidOperationException", | ||
"message": "Invalid operation on cartridge 'core'. The operation is only allowed on existing custom cartridge." | ||
} | ||
} | ||
### Mapped ErrorResponse | ||
{ | ||
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-operation", | ||
"title": "Invalid Operation", | ||
"detail": "Invalid operation on cartridge 'core'. The operation is only allowed on existing custom cartridge.", | ||
"targetCartridge": "core" | ||
} |
23 changes: 23 additions & 0 deletions
23
...5e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Documentation/baseUri.raml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#%RAML 1.0 DocumentationItem | ||
title: baseUri Standards | ||
content: | | ||
# NOTE: this is internal documentation. | ||
The baseUri has been standardized as the following. You should use the below snippet in your RAML definitions: | ||
baseUri: https://{shortCode}.api.commercecloud.salesforce.com/api-family/api-name/{version} | ||
version: v1 | ||
baseUriParameters: | ||
shortCode: | ||
description: A region-specific merchant identifier. | ||
example: 0dnz6oep | ||
pattern: ^([a-z0-9]+)(-[a-z0-9]+)*$ | ||
Of note: | ||
- the baseUri is templated URL that is templated for constency, all URLs accross commerce cloud will have the same baseUrl | ||
- you MUST set the values of the api-family and api-name in the URI to your api-family and api-name. These shouldn't ever change and should be in lower case kebab case | ||
- Api-family is also known as bounded context | ||
- Api-name is also known as root aggregate | ||
- the only baseUriParameter that will change between calls is `shortCode`. | ||
- `version` is special and will use the version of the API. |
23 changes: 23 additions & 0 deletions
23
...605e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/BoolFilter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"operator": "and", | ||
"filters": [ | ||
{ | ||
"termFilter": { | ||
"field": "id", | ||
"operator": "is", | ||
"values": [ | ||
"myId" | ||
] | ||
} | ||
}, | ||
{ | ||
"termFilter": { | ||
"field": "couponId", | ||
"operator": "is", | ||
"values": [ | ||
"couponOne" | ||
] | ||
} | ||
} | ||
] | ||
} |
33 changes: 33 additions & 0 deletions
33
...f605e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/BoolQuery.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"must": [ | ||
{ | ||
"textQuery": { | ||
"fields": [ | ||
"couponId" | ||
], | ||
"searchPhrase": "DEAL" | ||
} | ||
}, | ||
{ | ||
"textQuery": { | ||
"fields": [ | ||
"description" | ||
], | ||
"searchPhrase": "Big bargain deal" | ||
} | ||
} | ||
], | ||
"mustNot": [ | ||
{ | ||
"termQuery": { | ||
"fields": [ | ||
"enabled" | ||
], | ||
"operator": "is", | ||
"values": [ | ||
false | ||
] | ||
} | ||
} | ||
] | ||
} |
57 changes: 57 additions & 0 deletions
57
...f605e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/BoolQuery.raml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#%RAML 1.0 NamedExample | ||
MultipleOperatorExample: | ||
must: | ||
- textQuery: | ||
fields: | ||
- couponId | ||
searchPhrase: DEAL | ||
should: | ||
- textQuery: | ||
fields: | ||
- couponId | ||
searchPhrase: DEAL | ||
- textQuery: | ||
fields: | ||
- couponId | ||
- description | ||
searchPhrase: sale | ||
must_not: | ||
- textQuery: | ||
fields: | ||
- description | ||
searchPhrase: Big bargain | ||
AndOperatorExample: | ||
must: | ||
- textQuery: | ||
fields: | ||
- couponId | ||
searchPhrase: DEAL | ||
- termQuery: | ||
fields: | ||
- enabled | ||
operator: is | ||
values: | ||
- true | ||
OrOperatorExample: | ||
should: | ||
- textQuery: | ||
fields: | ||
- couponId | ||
searchPhrase: DEAL | ||
- textQuery: | ||
fields: | ||
- couponId | ||
- description | ||
searchPhrase: sale | ||
NotOperatorExample: | ||
must_not: | ||
- textQuery: | ||
fields: | ||
- description | ||
searchPhrase: Big bargain | ||
- termQuery: | ||
fields: | ||
- enabled | ||
operator: is | ||
values: | ||
- false |
9 changes: 9 additions & 0 deletions
9
...893f605e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/Filter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"termFilter": { | ||
"field": "enabled", | ||
"operator": "is", | ||
"values": [ | ||
false | ||
] | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/FilteredQuery.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"query": { | ||
"textQuery": { | ||
"fields": [ | ||
"couponId" | ||
], | ||
"searchPhrase": "disabled" | ||
} | ||
}, | ||
"filter": { | ||
"termFilter": { | ||
"field": "enabled", | ||
"operator": "is", | ||
"values": [ | ||
false | ||
] | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...05e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/NestedQuery.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"path": "order.shippingAddresses", | ||
"query": { | ||
"boolQuery": { | ||
"must": [ | ||
{ | ||
"boolQuery": { | ||
"must": [ | ||
{ | ||
"termQuery": { | ||
"fields": [ | ||
"order.shippingAddresses.firstName" | ||
], | ||
"operator": "is", | ||
"values": [ | ||
"John" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"boolQuery": { | ||
"must": [ | ||
{ | ||
"termQuery": { | ||
"fields": [ | ||
"order.shippingAddresses.lastName" | ||
], | ||
"operator": "is", | ||
"values": [ | ||
"Doe" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"scoreMode": "avg" | ||
} |
35 changes: 35 additions & 0 deletions
35
...bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/PaginatedSearchResultBase.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"limit" : 1, | ||
"hits" : [ | ||
{ | ||
"couponId": "MyCoupon", | ||
"creationDate": "2019-10-20T12:00:00Z", | ||
"description": "This coupon is used to give 10% off stuff.", | ||
"enabled": false, | ||
"exportedCodeCount": 0, | ||
"lastModified": "2019-10-30T04:23:59Z", | ||
"redemptionCount": 3, | ||
"redemptionLimits": { | ||
"limitPerCode": 1, | ||
"limitPerCustomer": 1, | ||
"limitPerTimeFrame": { | ||
"limit": 2, | ||
"redemptionTimeFrame": 24 | ||
} | ||
}, | ||
"singleCode": "MyCode", | ||
"systemCodesConfig": { | ||
"codePrefix": "SG", | ||
"numberOfCodes": 500000 | ||
}, | ||
"totalCodesCount": 50, | ||
"type": "single_code" | ||
} | ||
], | ||
"query" : { "textQuery": { "fields": ["id", "description"], "searchPhrase": "stuff" } }, | ||
"sorts" : [ | ||
{ "field": "couponId", "sortOrder": "desc" } | ||
], | ||
"offset" : 2, | ||
"total" : 8 | ||
} |
21 changes: 21 additions & 0 deletions
21
.../893f605e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/Query.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"filteredQuery": { | ||
"query": { | ||
"textQuery": { | ||
"fields": [ | ||
"couponId" | ||
], | ||
"searchPhrase": "disabled" | ||
} | ||
}, | ||
"filter": { | ||
"termFilter": { | ||
"field": "enabled", | ||
"operator": "is", | ||
"values": [ | ||
false | ||
] | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...05e-10e2-423a-bdb4-f952f56eb6d8/commerce-cloud-standards/1.0.27/Examples/QueryFilter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"query": { | ||
"termQuery": { | ||
"fields": [ | ||
"enabled", | ||
"active" | ||
], | ||
"operator": "is", | ||
"values": [ | ||
false | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.