Ensure Route

The command ensures that the route with the provided ID is created or modified. The full route must be provided to ensure (either update or create) the route. Non-present data will only be filled with defaults or left empty, but previous values will not be taken into consideration.

To ensure the route, you need to use the following PUT request:

PUT /gateways/{apigatewayId}/routes/{routeId}

Request

curl -X 'PUT' \
  'https://apigateway.de-txl.ionos.com/gateways/0620c174-dd3c-5eb4-87c8-e2b516553a00/routes/50982018-bb17-5cb9-bcd4-97f8bbc7dc23' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "50982018-bb17-5cb9-bcd4-97f8bbc7dc23",
  "metadata": {},
  "properties": {
    "name": "example-route",
    "type": "http",
    "paths": [
      "/foo/*",
      "/bar"
    ],
    "methods": [
      "GET",
      "POST"
    ],
    "websocket": false,
    "upstreams": [
      {
        "scheme": "http",
        "loadbalancer": "roundrobin",
        "host": "www.example.com",
        "port": 80,
        "weight": 100
      }
    ]
  }
}'

Response

200 Route successfully updated

{
  "id": "50982018-bb17-5cb9-bcd4-97f8bbc7dc23",
  "type": "route",
  "href": "/gateways/{apigatewayId}/routes/50982018-bb17-5cb9-bcd4-97f8bbc7dc23",
  "metadata": {
    "createdDate": "2020-12-10T13:37:50+01:00",
    "createdBy": "john.doe@example.com",
    "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "lastModifiedDate": "2020-12-11T13:37:50+01:00",
    "lastModifiedBy": "john.doe@example.com",
    "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "resourceURN": "ionos:<product>:<location>:<contract>:<resource-path>",
    "status": "AVAILABLE",
    "statusMessage": null,
    "publicEndpoint": "jf8u4tgr73sd-ag.87uhr654gq90.apigateway.de-txl.ionos.com"
  },
  "properties": {
    "name": "example-route",
    "type": "http",
    "paths": [
      "/foo/*",
      "/bar"
    ],
    "methods": [
      "GET",
      "POST"
    ],
    "websocket": false,
    "upstreams": [
      {
        "scheme": "http",
        "loadbalancer": "roundrobin",
        "host": "www.example.com",
        "port": 80,
        "weight": 100
      }
    ]
  }
}

201 Route successfully ensured

{
  "id": "50982018-bb17-5cb9-bcd4-97f8bbc7dc23",
  "type": "route",
  "href": "/gateways/{apigatewayId}/routes/50982018-bb17-5cb9-bcd4-97f8bbc7dc23",
  "metadata": {
    "createdDate": "2020-12-10T13:37:50+01:00",
    "createdBy": "john.doe@example.com",
    "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "lastModifiedDate": "2020-12-11T13:37:50+01:00",
    "lastModifiedBy": "john.doe@example.com",
    "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "resourceURN": "ionos:<product>:<location>:<contract>:<resource-path>",
    "status": "AVAILABLE",
    "statusMessage": null,
    "publicEndpoint": "jf8u4tgr73sd-ag.87uhr654gq90.apigateway.de-txl.ionos.com"
  },
  "properties": {
    "name": "example-route",
    "type": "http",
    "paths": [
      "/foo/*",
      "/bar"
    ],
    "methods": [
      "GET",
      "POST"
    ],
    "websocket": false,
    "upstreams": [
      {
        "scheme": "http",
        "loadbalancer": "roundrobin",
        "host": "www.example.com",
        "port": 80,
        "weight": 100
      }
    ]
  }
}

Last updated

Revision created

commented latest release