Setting up first API

I tried setting up the first API in tyk following the tutorial . My tyk_analytics.conf file looks like
{
“listen_port”: 3000,
“tyk_api_config”: {
“Host”: “http://localhost”,
“Port”: “8081”,
“Secret”: “352d20ee67be67f6340b4c0605b044b7”
},
“mongo_url”: “mongodb://127.0.0.1/tyk_analytics”,
“shared_node_secret”: “352d20ee67be67f6340b4c0605b044b7”,
“license_key”: “”,
“page_size”: 10,
“admin_secret”: “12345”,
“redis_port”: 6379,
“redis_host”: “localhost”,
“redis_password”: “”,
“force_api_defaults”: false,
“notify_on_change”: true,
“license_owner”: “Your Name”,
“hash_keys”: true,
“email_backend”: {},
“hide_listen_path”: false,
“use_sentry”: false,
“sentry_code”: “”,
“sentry_js_code”: “”,
“show_org_id”: true,
“enable_duplicate_slugs”: true,
“host_config” : {
“override_hostname”: “vm-parma-003.cisco.com”,
“disable_org_slug_prefix”: true,
“enable_host_names”: true,
“hostname”: “dashboard.tyk.local”,
“portal_domains”: {},
“portal_root_path”: “/portal”
},
“http_server_options”: {
“use_ssl”: false,
“certificates”: [
{}
]
},
“ui”: {
“login_page”: {},
“nav” : {},
“uptime”: {},
“portal”: {},
“designer”: {},
“languages”: {
“English”: “en”,
“Chinese”: “cn”,
“Korean”: “ko”
},
“default_lang”: “en”
},
“home_dir”: “/opt/tyk-dashboard”,
“identity_broker”: {
“enabled”: false,
“host”: {
“connection_string”: “http://localhost:3010”,
“secret”: “934893845123491238192381486djfhr87234827348”
}
},
“enable_aggregate_lookups”: true,
“aggregate_lookup_cutoff”: “01/07/2016”,
“oauth_redirect_uri_separator”: “;”,
“private_key_path”: “”
}

and my API end point is http://vm-parma-003.cisco.com/httpbin/
But when I try to access this it gives me 404 error. Can you please help me to solve this

1 Like

Hi, do you see any output in your logs?

Can you share your API settings?

Best.

Thanks for the reply,
I dont see any error messages in the log tyk-dashboard.stderr

time=“Dec 24 06:32:43” level=info msg=“Listening on port: 3000”
time=“Dec 24 06:32:43” level=info msg=“Loading routes…”
time=“Dec 24 06:32:43” level=info msg=“Registering nodes…”
time=“Dec 24 06:32:43” level=info msg=“Adding available nodes…”
time=“Dec 24 06:32:43” level=info msg=“Creating new Redis connection pool”
time=“Dec 24 06:32:43” level=info msg=“Socket server started”
time=“Dec 24 06:32:43” level=info msg="–> Standard listener (http) for UI notifications"
time=“Dec 24 06:32:43” level=info msg="–> Standard listener (http) for dashboard and API"
time=“Dec 24 06:32:43” level=info msg=“Starting zeroconf heartbeat”
time=“Dec 24 06:32:43” level=info msg=“Starting notification handler for gateway cluster”

API URL: http://vm-parma-003.cisco.com/httpbin/

And also my API settings : response for http://vm-parma-003.cisco.com:3000/api/apis
{
“apis”: [
{
“api_model”: {},
“api_definition”: {
“id”: “585e2fbbcc2e9b6547358684”,
“name”: “HttpBin”,
“slug”: “httpbin”,
“api_id”: “a1b84a7bfd5b4ce243c2705e7a3ac50e”,
“org_id”: “585e2afecc2e9b6547358683”,
“use_keyless”: false,
“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”: “Authorization”
},
“use_basic_auth”: false,
“enable_jwt”: false,
“use_standard_auth”: true,
“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”: “x-api-version”
},
“version_data”: {
“not_versioned”: true,
“versions”: {
“Default”: {
“name”: “Default”,
“expires”: “”,
“paths”: {
“ignored”: [],
“white_list”: [],
“black_list”: []
},
“use_extended_paths”: true,
“extended_paths”: {
“white_list”: [
{
“path”: “”,
“method_actions”: {
“GET”: {
“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”: 60,
“endpoint_returns_list”: false
},
“recheck_wait”: 0
}
},
“proxy”: {
“preserve_host_header”: false,
“listen_path”: “/httpbin/”,
“target_url”: “http://httpbin.org/”,
“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”: “hostname”,
“port_data_path”: “port”,
“target_path”: “/api-slug”,
“use_target_list”: false,
“cache_timeout”: 60,
“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”: 60,
“enable_cache”: true,
“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”: null
},
“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”: false,
“allowed_origins”: [],
“allowed_methods”: [],
“allowed_headers”: [],
“exposed_headers”: [],
“allow_credentials”: false,
“max_age”: 24,
“options_passthrough”: false,
“debug”: false
},
“domain”: “vm-parma-003.cisco.com”,
“do_not_track”: false,
“tags”: [],
“enable_context_vars”: false
},
“hook_references”: [],
“is_site”: false,
“sort_by”: 0
}
],
“pages”: 0
}

Hi, looks like a DNS or port issue.

Can you share the output of:

curl -v http://vm-parma-003.cisco.com/httpbin/

And just in case (is the gateway running on 8081?):

curl -v http://vm-parma-003.cisco.com:8081/httpbin/

Best.

Hi Matias,
Thanks for the reply. I don’t think the problem is the DNS name as there are other application running on this server like Tomcat. Also I tried connecting to Apache httpd server and it was working. The issue is only with this Tyk Application. It will be great if I get some help on this.
Below are the output of curl.

[[email protected] ~]# curl -v vm-parma-003.cisco.com/httpbin/

  • About to connect() to vm-parma-003.cisco.com port 80 (#0)

  • Trying 173.36.22.38… Connection refused

  • couldn’t connect to host

  • Closing connection #0
    curl: (7) couldn’t connect to host

  • About to connect() to vm-parma-003.cisco.com port 8081 (#0)

  • Trying 173.36.22.38… connected

  • Connected to vm-parma-003.cisco.com (173.36.22.38) port 8081 (#0)

GET /httpbin/ HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Host: vm-parma-003.cisco.com:8081
Accept: /

< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Mon, 09 Jan 2017 05:35:58 GMT
< Content-Length: 19
<
404 page not found

So you have other APIs working on the same gateway, on different listen paths?

Your API settings looks good.

No I am not able to set up any Tyk API.I was mentioning other application running on the server like web application within tomcat… I don’t see any errors also in the log. I am able to setup the API using dashboard successfully . But the issue is I am not able to get any response(gives) 404 error. I am stuck at this point and not able to proceed.

I understand. Do you see any request hitting your backend during the tests?