openwhisk-apigateway
openwhisk-apigateway copied to clipboard
When updating an existing API, a null resource is added
- Create an initial api under an existing tenant. POST /apis
"name": "/mwd_api2_bp",
"basePath": "/mwd_api2_bp",
"tenantId": "YOUR TENANT ID",
"resources": {
"/rp": {
"operations": {
"get": {
"backendMethod": "POST",
"backendUrl": "https://172.17.0.1/api/v1/namespaces/whisk.system/actions/newaction",
"policies": [
{
"type": "reqMapping",
"value": [
{
"action": "transform",
"from": {
"name": "*",
"location": "query"
},
"to": {
"name": "*",
"location": "body"
}
},
{
"action": "insert",
"from": {
"value": "Basic AUTHCODE"
},
"to": {
"name": "Authorization",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "application/json"
},
"to": {
"name": "Content-Type",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "blocking",
"location": "query"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "result",
"location": "query"
}
}
]
}
]
}
}
}
}
}
- Note the API id.
- Add a new path or operation. in this case i just added a new operation. PUT /apis/{apiid}
{
"id": "YOUR APP ID",
"name": "/mwd_api2_bp",
"basePath": "/mwd_api2_bp",
"tenantId": "YOUR TENANT ID",
"resources": {
"/rp": {
"operations": {
"get": {
"backendMethod": "POST",
"backendUrl": "https://172.17.0.1/api/v1/namespaces/whisk.system/actions/newaction",
"policies": [
{
"type": "reqMapping",
"value": [
{
"action": "transform",
"from": {
"name": "*",
"location": "query"
},
"to": {
"name": "*",
"location": "body"
}
},
{
"action": "insert",
"from": {
"value": "Basic AUTHCODE"
},
"to": {
"name": "Authorization",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "application/json"
},
"to": {
"name": "Content-Type",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "blocking",
"location": "query"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "result",
"location": "query"
}
}
]
}
]
},
"delete": {
"backendMethod": "POST",
"backendUrl": "https://172.17.0.1/api/v1/namespaces/whisk.system/actions/newaction",
"policies": [
{
"type": "reqMapping",
"value": [
{
"action": "transform",
"from": {
"name": "*",
"location": "query"
},
"to": {
"name": "*",
"location": "body"
}
},
{
"action": "insert",
"from": {
"value": "Basic AUTHCODE"
},
"to": {
"name": "Authorization",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "application/json"
},
"to": {
"name": "Content-Type",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "blocking",
"location": "query"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "result",
"location": "query"
}
}
]
}
]
}
}
}
}
}
- Note the response from the gw looks fine
- Issue GET /apis/{apiid}. Look for
"path":null
"tenantId": "YOUR TENANT ID",
"resources": {
"path": null,
"/rp": {
"operations": {