Hi,
I’m trying to add CORS support for an example API (just learning Tyk) but when I add Allowed Methods I get an error in the Admin Console saying “Couldn’t unmarshal API data”. The request/response is given below:
Request URL:https://admin.cloud.tyk.io/api/apis/5a1763eb8fdd780001c92a27
Request Method:PUT
Status Code:500 Internal Server Error
Remote Address:54.210.238.84:443
Request:
{“api_definition”:{“api_id”:“97644fc2e68844154c4152f62a0a4411”,“upstream_certificates”:{},“use_keyless”:false,“enable_coprocess_auth”: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”:{}}},“disable_quota”:false,“custom_middleware_bundle”:“”,“cache_options”:{“enable_cache”:false,“enable_upstream_cache_control”:false,“cache_timeout”:60,“cache_response_codes”:[],“cache_all_safe_requests”:false},“tag_headers”:[],“domain”:“”,“openid_options”:{“providers”:[],“segregate_by_client”:false},“active”:true,“config_data”:{},“notifications”:{“oauth_on_keychange_url”:“”,“shared_secret”:“”},“auth”:{“auth_header_name”:“Authorization”,“use_param”:true,“param_name”:“authorization”,“use_certificate”:false,“cookie_name”:“”},“check_host_against_uptime_tests”:false,“hmac_allowed_clock_skew”:-1,“uptime_tests”:{“check_list”:[],“config”:{“service_discovery”:{“use_discovery_service”:false,“query_endpoint”:“”,“use_nested_query”:false,“parent_data_path”:“”,“data_path”:“”,“cache_timeout”:60}}},“enable_jwt”:false,“name”:“weather”,“slug”:“weather”,“oauth_meta”:{“allowed_access_types”:[],“allowed_authorize_types”:[],“auth_login_redirect”:“”},“CORS”:{“enable”:true,“max_age”:24,“allow_credentials”:false,“exposed_headers”:[],“allowed_headers”:[],“options_passthrough”:false,“debug”:false,“allowed_origins”:[““],“allowed_methods”:[{“id”:“get”,“name”:“GET”},{“id”:“options”,“name”:“OPTIONS”}]},“event_handlers”:{“events”:{}},“proxy”:{“enable_load_balancing”:false,“listen_path”:”/97644fc2e68844154c4152f62a0a4411/“,“strip_listen_path”:true,“preserve_host_header”:false,“target_list”:[],“target_url”:“https://query.yahooapis.com/v1/public/yql",“service_discovery”:{“cache_timeout”:0,“parent_data_path”:“”,“query_endpoint”:“”,“use_discovery_service”:false,“_sd_show_port_path”:false,“target_path”:“”,“use_nested_query”:false,“data_path”:“”,“port_data_path”:“”},“check_host_against_uptime_tests”:false},“client_certificates”:[],“use_basic_auth”:false,“version_data”:{“not_versioned”:true,“versions”:{“Default”:{“name”:“Default”,“expires”:“”,“override_target”:“”,“extended_paths”:{“url_rewrites”:[{“method”:“GET”,“timeout”:0,“path”:“weather/{city}”,“add_headers”:{},“samples”:100,“rewrite_to”:“?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D\”$1\")&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys”,“template_data”:{“input_type”:”“,“template_mode”:”“,“enable_session”:false,“template_source”:”“},“function_source_uri”:”“,“threshold_percent”:0.1,“delete_headers”:[],“response_function_name”:“myVirtualHandler”,”_lists":[],“match_pattern”:"weather/(.)”,“function_source_type”:“blob”,“return_to_service_after”:60,“size_limit”:0,“use_session”:false,“method_actions”:{}},{“method”:“GET”,“timeout”:0,“path”:“wind/{city}”,“add_headers”:{},“samples”:100,“rewrite_to”:“?q=select%20wind%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22$1%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys”,“template_data”:{“input_type”:“”,“template_mode”:“”,“enable_session”:false,“template_source”:“”},“function_source_uri”:“”,“threshold_percent”:0.1,“delete_headers”:[],“response_function_name”:“myVirtualHandler”,“_lists”:[],“match_pattern”:“wind/(.*)”,“function_source_type”:“blob”,“return_to_service_after”:60,“size_limit”:0,“use_session”:false,“method_actions”:{}}]},“global_headers”:{},“global_headers_remove”:[],“global_size_limit”:0,“use_extended_paths”:true}}},“use_standard_auth”:true,“disable_rate_limit”:false,“definition”:{“key”:“x-api-version”,“location”:“header”},“use_oauth2”:false,“allowed_ips”:[],“org_id”:“5a17549cc72adf00015ee738”,“enable_ip_whitelisting”:false,“global_rate_limit”:{“rate”:0,“per”:0},“enable_context_vars”:false,“tags”:[],“strip_auth_data”:false,“id”:“5a1763eb8fdd780001c92a27”,“enable_signature_checking”:false,“use_openid”:false,“enable_batch_request_support”:false,“response_processors”:[],“use_mutual_tls_auth”:false,“auth_provider”:{“name”:“”,“storage_engine”:“”,“meta”:{}},“do_not_track”:false,“dont_set_quota_on_create”:false,“expire_analytics_after”:0,“session_lifetime”:0},“hook_references”:[],“is_site”:false,“sort_by”:0}
Response:
{“Status”:“Error”,“Message”:“Couldn’t unmarshal API data”,“Meta”:null}
Regards,
Scott