cortezaproject / corteza

Low-code platform
https://cortezaproject.org
Apache License 2.0
1.62k stars 372 forks source link

When creating an Integration Gateway route via the API, "meta" fields are not applied during POST #1488

Open jem-Solytica opened 1 year ago

jem-Solytica commented 1 year ago

Is there an existing issue for this?

Version of Corteza

2023.3.8

Current Behavior

Using Bash/cURL to create a new Integration Gateway path using POST via the API results in meta values not being applied (although /api/docs sample payload shows meta for the POST request). However, extracting the new routeID from the API response and sending a new PUT request with the same payload causes the meta values to apply correctly.

Expected Behavior

Meta values should apply in first step when new route is created.

Steps To Reproduce

New Route Payload:

{
  "endpoint": "/simpleTest",
  "method": "POST",
  "enabled": false,
  "meta": {
    "debug": true,
    "async": false,
    "description": "This is a description."
  }
}

cURL Command (URI and data-raw omitted; API token obtained and auth header generated separately):

curl -X POST https://***/api/system/apigw/route \
        --data-raw "***" \
        --silent --location \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --header "${CORTEZA_API_AUTH_HDR}"

Response (identifiers omitted):

{"response":{"routeID":"***","endpoint":"/simpleTest","method":"POST","enabled":false,"group":"0","meta":{"debug":false,"async":false,"description":""},"createdAt":"2023-10-24T01:53:50Z","createdBy":"***","canGrant":true,"canUpdateApigwRoute":true,"canDeleteApigwRoute":true}}

Subsequent PUT request successfully applies meta values:

curl -X PUT https://***/api/system/apigw/route/{New routeID} \
        --data-raw "***" \
        --silent --location \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --header "${CORTEZA_API_AUTH_HDR}"

Environment and versions

No response

Anything else?

Known workaround:

  1. Send a POST request to create the route
  2. Extract the routeID from the response to use the in the URI in the next step
  3. Send a PUT request with the original payload to api/system/apigw/route/{routeID}
github-actions[bot] commented 10 months ago

Stale issue message