Skip to content

Instantly share code, notes, and snippets.

@cneijenhuis
Last active November 15, 2017 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cneijenhuis/51b85f45a47d469fdd57c1950a91b61d to your computer and use it in GitHub Desktop.
Save cneijenhuis/51b85f45a47d469fdd57c1950a91b61d to your computer and use it in GitHub Desktop.
AWS API Gateway to forward cart updates to lambda and all other requests to the commercetools API
{
"swagger": "2.0",
"info": {
"version": "2017-11-15T12:16:50Z",
"title": "test"
},
"host": "fa2krnx8xb.execute-api.eu-west-1.amazonaws.com",
"basePath": "/serverless_example_1",
"schemes": [
"https"
],
"paths": {
"/": {
"get": {
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "200 response",
"schema": {
"$ref": "#/definitions/Empty"
}
}
},
"x-amazon-apigateway-integration": {
"responses": {
"default": {
"statusCode": "200"
}
},
"uri": "https://api.sphere.io/${stageVariables.project_key}",
"passthroughBehavior": "when_no_match",
"httpMethod": "GET",
"type": "http_proxy"
}
}
},
"/carts/{id+}": {
"post": {
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "200 response",
"schema": {
"$ref": "#/definitions/Empty"
}
}
},
"x-amazon-apigateway-integration": {
"responses": {
"default": {
"statusCode": "200"
}
},
"uri": "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:564387806506:function:cart-update-ireland/invocations",
"passthroughBehavior": "when_no_match",
"httpMethod": "POST",
"cacheNamespace": "mkky20",
"cacheKeyParameters": [
"method.request.path.id"
],
"contentHandling": "CONVERT_TO_TEXT",
"type": "aws_proxy"
}
}
},
"/{proxy+}": {
"x-amazon-apigateway-any-method": {
"produces": [
"application/json"
],
"parameters": [
{
"name": "proxy",
"in": "path",
"required": true,
"type": "string"
}
],
"responses": {},
"x-amazon-apigateway-integration": {
"responses": {
"default": {
"statusCode": "200"
}
},
"requestParameters": {
"integration.request.path.proxy": "method.request.path.proxy"
},
"uri": "https://api.sphere.io/${stageVariables.project_key}/{proxy}",
"passthroughBehavior": "when_no_match",
"httpMethod": "ANY",
"cacheNamespace": "6gzjns",
"cacheKeyParameters": [
"method.request.path.proxy"
],
"type": "http_proxy"
}
}
}
},
"definitions": {
"Empty": {
"type": "object",
"title": "Empty Schema"
}
},
"x-amazon-apigateway-binary-media-types": [
"*/*"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment