Skip to content

Instantly share code, notes, and snippets.

@real34
Created May 23, 2017 06:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save real34/2311e732ce5c0c420fa571f63b69e8ce to your computer and use it in GitHub Desktop.
Save real34/2311e732ce5c0c420fa571f63b69e8ce to your computer and use it in GitHub Desktop.
Pact specification for retrieving urls from a headless Magento2 (custom module)
{
"consumer": {
"name": "Front Commerce"
},
"provider": {
"name": "Magento 2 Url"
},
"interactions": [
{
"description": "A find request for entity with type category and id 6",
"provider_state": "Existing url rewrites for categories 5 and 6",
"request": {
"method": "GET",
"path": "/rest/V1/frontcommerce/urls/find",
"query": "entityType=category&entityIds[0]=6"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"identifier": 6,
"type": "category",
"url": "gear/watches.html"
}
]
}
},
{
"description": "A find request for entities with type category and ids 5, 6",
"provider_state": "Existing url rewrites for categories 5 and 6",
"request": {
"method": "GET",
"path": "/rest/V1/frontcommerce/urls/find",
"query": "entityType=category&entityIds[0]=5&entityIds[1]=6"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"identifier": 6,
"type": "category",
"url": "gear/watches.html"
},
{
"identifier": 5,
"type": "category",
"url": "gear/bags.html"
}
]
}
},
{
"description": "A match request for the gear/watches.html url",
"provider_state": "Existing url rewrites for categories 5 and 6",
"request": {
"method": "GET",
"path": "/rest/V1/frontcommerce/urls/match",
"query": "urls[0]=gear%2Fwatches.html"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"identifier": 6,
"type": "category",
"url": "gear/watches.html"
}
]
}
},
{
"description": "A match request for the gear/watches.html and gear/bags.html urls",
"provider_state": "Existing url rewrites for categories 5 and 6",
"request": {
"method": "GET",
"path": "/rest/V1/frontcommerce/urls/match",
"query": "urls[0]=gear%2Fwatches.html&urls[1]=gear%2Fbags.html"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"identifier": 6,
"type": "category",
"url": "gear/watches.html"
},
{
"identifier": 5,
"type": "category",
"url": "gear/bags.html"
}
]
}
}
],
"metadata": {
"pactSpecificationVersion": "2.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment