404 error after API was imported with swagger content

Hi,

I’m using TYK cloud. I’m facing an 404 error issue. We can reproduce the issue with below steps:

  1. Create API with import swagger through dashboard API.
  2. Send API request via by postman: https://tma-dev-tea.cloud.tyk.io/404error/pet/findByStatus?status=available (included header name: version: 1.0.0).
    => Response:404 page not found
    Note: I waited more 10s and tried many time but not worked.

But there is a strange thing is that when I click “Update” button in “EDIT API” page of TYK dashboard OR import new API then send API request as above, the issue was disappeared.

Could you please help me have a look into the issue and show me how to fix this.

Thanks,
Toan Do

Has this occurred again at all since you fixed it?

Hi Josh,

No, When click “Update” button, the issue disappeared and never occurred again.

herejosh

Click “Update” button or import new API are only workarounds. Could you show me how to fix the issue without those workarounds?

Thanks,
Toan Do

When you are clicking update on the api it is forcing a reload of the gateway, which means the endpoint is there to be hit. I’m not sure why this is not happening when you create the API in the first place, i’ll replicate and see what I can find for you.

Thanks Josh, waiting for your good news :slight_smile:

Hi,

I tried to recreate this with two different accounts and the APIs were registering normally, it may have been a one-time glitch - are you still experiencing the issue?

M.

Hi Martin,

I’m still facing the issue. Please see my attached API pics and the API detail before and after when click “update” button.

API_versionend_point_designer

API detail before click “update” button:

Blockquote
{
“id”: “5a5430d69764510001dbc4bb”,
“name”: “stillfacingtheissue Swagger Petstore”,
“slug”: “stillfacingtheissue”,
“api_id”: “b7484d57bde94dbe79a93bd36ad3c5d5”,
“org_id”: “5a4f35569764510001dbc400”,
“use_keyless”: true,
“use_oauth2”: false,
“use_openid”: false,
“openid_options”: {
“providers”: ,
“segregate_by_client”: false
},
“oauth_meta”: {
“allowed_access_types”: ,
“allowed_authorize_types”: ,
“auth_login_redirect”: “”
},
“auth”: {
“use_param”: false,
“param_name”: “”,
“use_cookie”: false,
“cookie_name”: “”,
“auth_header_name”: “”,
“use_certificate”: false
},
“use_basic_auth”: false,
“use_mutual_tls_auth”: false,
“client_certificates”: ,
“upstream_certificates”: {},
“enable_jwt”: false,
“use_standard_auth”: false,
“enable_coprocess_auth”: false,
“jwt_signing_method”: “”,
“jwt_source”: “”,
“jwt_identity_base_field”: “”,
“jwt_client_base_field”: “”,
“jwt_policy_field_name”: “”,
“notifications”: {
“shared_secret”: “”,
“oauth_on_keychange_url”: “”
},
“enable_signature_checking”: false,
“hmac_allowed_clock_skew”: 0,
“base_identity_provided_by”: “”,
“definition”: {
“location”: “header”,
“key”: “version”
},
“version_data”: {
“not_versioned”: false,
“versions”: {
“1.0.0”: {
“name”: “1.0.0”,
“expires”: “”,
“paths”: {
“ignored”: ,
“white_list”: ,
“black_list”:
},
“use_extended_paths”: true,
“extended_paths”: {
“white_list”: [
{
“path”: “/pet/findbystatus”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
}
],
“transform_response_headers”: [
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“add_headers”: {},
“path”: “/pet/findbystatus”,
“method”: “GET”,
“act_on”: false
}
]
},
“global_headers”: {},
“global_headers_remove”: ,
“global_size_limit”: 0,
“override_target”: “”
}
}
},
“uptime_tests”: {
“check_list”: ,
“config”: {
“expire_utime_after”: 0,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 0,
“endpoint_returns_list”: false
},
“recheck_wait”: 0
}
},
“proxy”: {
“preserve_host_header”: false,
“listen_path”: “/b7484d57bde94dbe79a93bd36ad3c5d5/”,
“target_url”: “http://petstore.swagger.io/v2”,
“strip_listen_path”: true,
“enable_load_balancing”: false,
“target_list”: ,
“check_host_against_uptime_tests”: false,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 0,
“endpoint_returns_list”: false
}
},
“disable_rate_limit”: false,
“disable_quota”: false,
“custom_middleware”: {
“pre”: ,
“post”: ,
“post_key_auth”: ,
“auth_check”: {
“name”: “”,
“path”: “”,
“require_session”: false
},
“response”: ,
“driver”: “”,
“id_extractor”: {
“extract_from”: “”,
“extract_with”: “”,
“extractor_config”: {}
}
},
“custom_middleware_bundle”: “”,
“cache_options”: {
“cache_timeout”: 0,
“enable_cache”: false,
“cache_all_safe_requests”: false,
“cache_response_codes”: ,
“enable_upstream_cache_control”: false
},
“session_lifetime”: 0,
“active”: true,
“auth_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“session_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“event_handlers”: {
“events”: {}
},
“enable_batch_request_support”: false,
“enable_ip_whitelisting”: false,
“allowed_ips”: ,
“dont_set_quota_on_create”: false,
“expire_analytics_after”: 0,
“response_processors”: ,
“CORS”: {
“enable”: true,
“allowed_origins”: ,
“allowed_methods”: [
“GET”
],
“allowed_headers”: [
“version”,
“apikey”
],
“exposed_headers”: [
“version”,
“apikey”
],
“allow_credentials”: false,
“max_age”: 0,
“options_passthrough”: false,
“debug”: false
},
“domain”: “”,
“do_not_track”: false,
“tags”: ,
“enable_context_vars”: false,
“config_data”: {},
“tag_headers”: ,
“global_rate_limit”: {
“rate”: 0,
“per”: 0
},
“strip_auth_data”: false
}

API detail after click “update” button:

Blockquote
{
“id”: “5a5430d69764510001dbc4bb”,
“name”: “stillfacingtheissue Swagger Petstore”,
“slug”: “stillfacingtheissue”,
“api_id”: “b7484d57bde94dbe79a93bd36ad3c5d5”,
“org_id”: “5a4f35569764510001dbc400”,
“use_keyless”: true,
“use_oauth2”: false,
“use_openid”: false,
“openid_options”: {
“providers”: ,
“segregate_by_client”: false
},
“oauth_meta”: {
“allowed_access_types”: ,
“allowed_authorize_types”: ,
“auth_login_redirect”: “”
},
“auth”: {
“use_param”: false,
“param_name”: “”,
“use_cookie”: false,
“cookie_name”: “”,
“auth_header_name”: “”,
“use_certificate”: false
},
“use_basic_auth”: false,
“use_mutual_tls_auth”: false,
“client_certificates”: ,
“upstream_certificates”: {},
“enable_jwt”: false,
“use_standard_auth”: false,
“enable_coprocess_auth”: false,
“jwt_signing_method”: “”,
“jwt_source”: “”,
“jwt_identity_base_field”: “”,
“jwt_client_base_field”: “”,
“jwt_policy_field_name”: “”,
“notifications”: {
“shared_secret”: “”,
“oauth_on_keychange_url”: “”
},
“enable_signature_checking”: false,
“hmac_allowed_clock_skew”: -1,
“base_identity_provided_by”: “”,
“definition”: {
“location”: “header”,
“key”: “version”
},
“version_data”: {
“not_versioned”: false,
“versions”: {
“1.0.0”: {
“name”: “1.0.0”,
“expires”: “”,
“paths”: {
“ignored”: ,
“white_list”: ,
“black_list”:
},
“use_extended_paths”: true,
“extended_paths”: {
“white_list”: [
{
“path”: “/pet/findbystatus”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
}
],
“transform_response_headers”: [
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“add_headers”: {},
“path”: “/pet/findbystatus”,
“method”: “GET”,
“act_on”: false
}
]
},
“global_headers”: {},
“global_headers_remove”: ,
“global_size_limit”: 0,
“override_target”: “”
}
}
},
“uptime_tests”: {
“check_list”: ,
“config”: {
“expire_utime_after”: 0,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 60,
“endpoint_returns_list”: false
},
“recheck_wait”: 0
}
},
“proxy”: {
“preserve_host_header”: false,
“listen_path”: “/b7484d57bde94dbe79a93bd36ad3c5d5/”,
“target_url”: “http://petstore.swagger.io/v2”,
“strip_listen_path”: true,
“enable_load_balancing”: false,
“target_list”: ,
“check_host_against_uptime_tests”: false,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 0,
“endpoint_returns_list”: false
}
},
“disable_rate_limit”: false,
“disable_quota”: false,
“custom_middleware”: {
“pre”: ,
“post”: ,
“post_key_auth”: ,
“auth_check”: {
“name”: “”,
“path”: “”,
“require_session”: false
},
“response”: ,
“driver”: “”,
“id_extractor”: {
“extract_from”: “”,
“extract_with”: “”,
“extractor_config”: {}
}
},
“custom_middleware_bundle”: “”,
“cache_options”: {
“cache_timeout”: 0,
“enable_cache”: false,
“cache_all_safe_requests”: false,
“cache_response_codes”: ,
“enable_upstream_cache_control”: false
},
“session_lifetime”: 0,
“active”: true,
“auth_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“session_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“event_handlers”: {
“events”: {}
},
“enable_batch_request_support”: false,
“enable_ip_whitelisting”: false,
“allowed_ips”: ,
“dont_set_quota_on_create”: false,
“expire_analytics_after”: 0,
“response_processors”: [
{
“name”: “header_injector”,
“options”: {}
}
],
“CORS”: {
“enable”: true,
“allowed_origins”: ,
“allowed_methods”: [
“GET”
],
“allowed_headers”: [
“version”,
“apikey”
],
“exposed_headers”: [
“version”,
“apikey”
],
“allow_credentials”: false,
“max_age”: 0,
“options_passthrough”: false,
“debug”: false
},
“domain”: “”,
“do_not_track”: false,
“tags”: ,
“enable_context_vars”: false,
“config_data”: {},
“tag_headers”: ,
“global_rate_limit”: {
“rate”: 0,
“per”: 0
},
“strip_auth_data”: false
}

Thanks,
Toan Do

Hi Martin and Josh,

I just saw that After the API was created, SOMETIME we must wait for 3 to 4 minutes (without clicking update button), the issue is disappeared and the API work correctly.

  1. Is this expected? What’s the delay time so that the API go live and work correctly?
  2. Is there a way that make the API to go live right after it was created that without clicking update button?

Note: I’m using Dashboard Rest API for my code.

Thanks,
Toan Do

If you are using the API then you may be sending the wrong thing, what are you sending in your API request to create the API?

Sure Martin. Let me double check and send you the detailed steps and what I sent in my request.
But firstly could you please share me what did the update button do when it was clicked?

Thanks,
Toan Do

Hi Martin,

I’m using Guzzle to send Rest request. This is my steps:

  1. Send Import API request with swagger content:

     POST /api/import/swagger/ HTTP/1.1
     Host: admin.cloud.tyk.io
     Authorization:e60eed74d73f488062b1f326545d2ca3
    

    {
    “swagger”: “{swagger data…}”,
    “insert_into_api”: false,
    “api_id”: “”,
    “upstream_url”: “http://petstore.swagger.io/v2
    }

  2. Getting API detail (which was just imported above):
    GET /api/apis/5a5470509764510001dbc4cf HTTP/1.1
    Host: admin.cloud.tyk.io
    Authorization:e60eed74d73f488062b1f326545d2ca3

  3. Updating API detail (which was just imported above), what to update:

  • Update authentication to Open - keyless:
    $auth = new \stdClass();
    $auth->use_cookie = false;
    $auth->cookie_name = “”;
    $auth->use_param = false;
    $auth->param_name = “”;
    $auth->auth_header_name = “”;
    $currentApiDetail->api_definition->use_standard_auth = false;
    $currentApiDetail->api_definition->use_keyless = true;
    $currentApiDetail->api_definition->auth = $auth;

  • Sort whitelist paths.

  • Deleting redundant response header (Access-Control-Allow-Origin) and adding header injector since it cause multiple response header values issue.

      $toBeDeletedResponseHeader = new \stdClass();
      $toBeDeletedResponseHeader->delete_headers = 'Access-Control-Allow-Origin';
      $toBeDeletedResponseHeader->path = $path;
      $toBeDeletedResponseHeader->method = strtoupper($verb);
      $versionValue->extended_paths->transform_response_headers[] = $toBeDeletedResponseHeader;
    

    $responseHeaderInjector = new \stdClass();
    $responseHeaderInjector->name = ‘header_injector’;
    $responseHeaderInjector->options = new \stdClass();
    $currentApiDetail->api_definition->response_processors[0] = $responseHeaderInjector;

  • Update CORS options:
    $currentApiDetail->api_definition->CORS->enable = $enabled;
    unset($currentApiDetail->api_definition->CORS->allowed_methods); // clear allowed methods before set again.
    $currentApiDetail->api_definition->CORS->allowed_methods = $allowedMethods;
    $currentApiDetail->api_definition->CORS->allowed_headers = $allowedHeaders;
    $currentApiDetail->api_definition->CORS->exposed_headers = $exposedHeaders;

Note:
allowed methods: GET, POST, PUT, DELETE.
allowedHeaders/exposedHeaders: version, apiKey => they are version and authentication header name.

This is full update request:

    PUT /api/apis/5a54757234b63b00011d0fc3 HTTP/1.1
	Host: admin.cloud.tyk.io
	Authorization:e60eed74d73f488062b1f326545d2ca3
{
	Body_of_api_detail_that_to_be_updated
}

Note: remove update steps, the issue still occur.

Hi Martin and Josh,

There is an update for you is that importing API swagger from my code or TYK dashboard (https://admin.cloud.tyk.io) is also having same issue.
=> I ALSO need to click update button so that the API work correctly.

I think we need to see the actual API Definition JSON that is being sent - I think that’s where the problem is.

Hi Martin,

This is actual API definition JSON that is being sent:

Blockquote
{
“api_definition”: {
“id”: “5a55868134b63b00011d1034”,
“name”: “jsoncontent4 Swagger Petstore”,
“slug”: “jsoncontent4”,
“api_id”: “9ffe725718ee42e47bb277a578175e42”,
“org_id”: “5a4f35569764510001dbc400”,
“use_keyless”: true,
“use_oauth2”: false,
“use_openid”: false,
“openid_options”: {
“providers”: ,
“segregate_by_client”: false
},
“oauth_meta”: {
“allowed_access_types”: ,
“allowed_authorize_types”: ,
“auth_login_redirect”: “”
},
“auth”: {
“use_cookie”: false,
“cookie_name”: “”,
“use_param”: false,
“param_name”: “”,
“auth_header_name”: “”
},
“use_basic_auth”: false,
“use_mutual_tls_auth”: false,
“client_certificates”: ,
“upstream_certificates”: {},
“enable_jwt”: false,
“use_standard_auth”: false,
“enable_coprocess_auth”: false,
“jwt_signing_method”: “”,
“jwt_source”: “”,
“jwt_identity_base_field”: “”,
“jwt_client_base_field”: “”,
“jwt_policy_field_name”: “”,
“notifications”: {
“shared_secret”: “”,
“oauth_on_keychange_url”: “”
},
“enable_signature_checking”: false,
“hmac_allowed_clock_skew”: 0,
“base_identity_provided_by”: “”,
“definition”: {
“location”: “header”,
“key”: “version”
},
“version_data”: {
“not_versioned”: false,
“versions”: {
“1.0.0”: {
“name”: “1.0.0”,
“expires”: “”,
“paths”: {
“ignored”: ,
“white_list”: ,
“black_list”:
},
“use_extended_paths”: true,
“extended_paths”: {
“transform_response_headers”: [
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user/logout”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user/login”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user/createwithlist”,
“method”: “POST”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user/createwitharray”,
“method”: “POST”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user/{username}”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user/{username}”,
“method”: “PUT”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user/{username}”,
“method”: “DELETE”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/user”,
“method”: “POST”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/store/order/{orderid}”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/store/order/{orderid}”,
“method”: “DELETE”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/store/order”,
“method”: “POST”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/store/inventory”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet/findbytags”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet/findbystatus”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet/{petid}/uploadimage”,
“method”: “POST”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet/{petid}”,
“method”: “GET”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet/{petid}”,
“method”: “POST”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet/{petid}”,
“method”: “DELETE”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet”,
“method”: “POST”
},
{
“delete_headers”: [
“Access-Control-Allow-Origin”
],
“path”: “/pet”,
“method”: “PUT”
}
],
“white_list”: [
{
“path”: “/user/logout”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/user/login”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/user/createwithlist”,
“method_actions”: {
“POST”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/user/createwitharray”,
“method_actions”: {
“POST”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/user/{username}”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
},
“PUT”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
},
“DELETE”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/user”,
“method_actions”: {
“POST”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/store/order/{orderid}”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
},
“DELETE”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/store/order”,
“method_actions”: {
“POST”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/store/inventory”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/pet/findbytags”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/pet/findbystatus”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/pet/{petid}/uploadimage”,
“method_actions”: {
“POST”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/pet/{petid}”,
“method_actions”: {
“GET”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
},
“POST”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
},
“DELETE”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
},
{
“path”: “/pet”,
“method_actions”: {
“POST”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
},
“PUT”: {
“action”: “no_action”,
“code”: 200,
“data”: “”,
“headers”: {}
}
}
}
]
},
“global_headers”: {},
“global_headers_remove”: ,
“global_size_limit”: 0,
“override_target”: “”
}
}
},
“uptime_tests”: {
“check_list”: ,
“config”: {
“expire_utime_after”: 0,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 0,
“endpoint_returns_list”: false
},
“recheck_wait”: 0
}
},
“proxy”: {
“preserve_host_header”: false,
“listen_path”: “/3398feb8c10447d177f7d3e927c1428a/”,
“target_url”: “http://petstore.swagger.io/v2”,
“strip_listen_path”: true,
“enable_load_balancing”: false,
“target_list”: ,
“check_host_against_uptime_tests”: false,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 0,
“endpoint_returns_list”: false
}
},
“disable_rate_limit”: false,
“disable_quota”: false,
“custom_middleware”: {
“pre”: ,
“post”: ,
“post_key_auth”: ,
“auth_check”: {
“name”: “”,
“path”: “”,
“require_session”: false
},
“response”: ,
“driver”: “”,
“id_extractor”: {
“extract_from”: “”,
“extract_with”: “”,
“extractor_config”: {}
}
},
“custom_middleware_bundle”: “”,
“cache_options”: {
“cache_timeout”: 0,
“enable_cache”: false,
“cache_all_safe_requests”: false,
“cache_response_codes”: ,
“enable_upstream_cache_control”: false
},
“session_lifetime”: 0,
“active”: true,
“auth_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“session_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“event_handlers”: {
“events”: {}
},
“enable_batch_request_support”: false,
“enable_ip_whitelisting”: false,
“allowed_ips”: ,
“dont_set_quota_on_create”: false,
“expire_analytics_after”: 0,
“response_processors”: ,
“CORS”: {
“enable”: true,
“allowed_origins”: ,
“allowed_headers”: [
“version”,
“apikey”
],
“exposed_headers”: [
“version”,
“apikey”
],
“allow_credentials”: false,
“max_age”: 0,
“options_passthrough”: false,
“debug”: false,
“allowed_methods”: [
“POST”,
“PUT”,
“GET”,
“DELETE”
]
},
“domain”: “”,
“do_not_track”: false,
“tags”: ,
“enable_context_vars”: false,
“config_data”: {},
“tag_headers”: ,
“global_rate_limit”: {
“rate”: 0,
“per”: 0
},
“strip_auth_data”: false
}
}

Thanks,
Toan Do

Hmmm, that doesn’t look right - the object thy needs to get sent to a dashboard endpoint requires the Api definition object to be wrapped in an api_definition field:

https://tyk.io/docs/tyk-dashboard-api/api-definitions/

Sorry, but actually it was wrapped in an api_definition field. Corrected above json.

Ok, looking at the above though your API IDs don’t match up? You are GETting 5a5470509764510001dbc4cf and PUTting to 5a54757234b63b00011d0fc3 but the API Definition you have posted is 5a55868134b63b00011d1034?

Are these all from different APIs?

Hi Martin,

where are 5a5470509764510001dbc4cf and 5a54757234b63b00011d0fc3? It seems they’re are not my API IDs.
I posted and put same API ID 5a55868134b63b00011d1034.

One important update for you: everything worked fine when I created tyk API with API definiton (https://tyk.io/docs/tyk-dashboard-api/api-definitions/) instead of importing API with swagger content (https://tyk.io/docs/configure/import-apis/).

So I think that there is a bug or wrong thing with importing API with swagger content (Note that: import from my code or TYK dashboard having same issue).

Thanks,
Toan Do

5a5470509764510001dbc4cf:

And: 5a54757234b63b00011d0fc3

With the dashboard API you must use the id field, not the API ID field.