Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:24:39 +0000.
Sender:Tor Inge Skaar
.
Date:Friday, 18 September 2015 15:07:29 UTC+1.
In the API Designer in the Dashboard, you can specify an API slug for the new API you’re creating. Now, I was under the impression that you could leave the auto-generated listen path as is and Tyk would also listen for the slug. I.e. that you could use the slug in the request URI instead of the API ID.
API Name: “Test API”
API Slug: test
Target URL: http://somehost:someport
Listen Path: /258dfd04a6fe423c72b65ccac1b0b84a/
But when I try this…
http -v tykgw.example.com/test/resource/1
GET /test/resource/1 HTTP/1.1
Accept: /
Accept-Encoding: gzip, deflate, compress
Host: tykgw.example.com
User-Agent: HTTPie/0.8.0
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Length: 19
Content-Type: text/plain; charset=utf-8
Date: Fri, 18 Sep 2015 13:41:57 GMT
X-Content-Type-Options: nosniff
404 page not found
…it doesn’t work.
Now, if I change the Listen Path…
API Name: “Test API”
API Slug: test
Target URL: http://somehost:someport
Listen Path: /test/
…and rerun my test…
http -v tykgw.example.com/test/resource/1
GET /test/resource/1 HTTP/1.1
Accept: /
Accept-Encoding: gzip, deflate, compress
Host: tykgw.example.com
User-Agent: HTTPie/0.8.0
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 123
Content-Type: application/json; charset=utf-8
Date: Fri, 18 Sep 2015 14:00:09 GMT
Server: gunicorn/17.5
X-Ratelimit-Limit: -1
X-Ratelimit-Remaining: 0
X-Ratelimit-Reset: 1442583650
{
“id”: 1,
“text”: “Hello”
}
…it works as I want it to work.
Have I misunderstood the function of the API slug vs the Listen Path?
Best regards,
Tor Inge Skaar