API URL attribute replacement example

This shows an example of using the IKANOW API url replacement syntax.  This syntax is useful because Restlet will fail on long url attributes.

How to Use

Any attribute of a url can be replaced with a variable denoted by a $variable_name e.g. http://server/api/social/community/add/$name/$desc/$tags
Once you replace an attribute with a variable you can set the value in the query arguments instead e.g. http://server/api/social/community/add/$name/$desc/$tags?name=some%20name&desc=some%20desc&tags=tag1,tag2

Example

The social/community/add/{name}/{description}/{tags} api call allows you to create a new community giving a name, description, and some tags.  This can be problematic if you have a large description or a large number of tags you want to send as restlet will drop the request if the url becomes too long.  See example below:

Too long of request
curl https://infinite.ikanow.com/api/social/community/add/New%20Community/long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20/news,entertainment,fun

will result in a 404 "not found" error

 

This can be avoided with URL attribute replacement:

Long request using replacement
curl https://infinite.ikanow.com/api/social/community/add/New%20Community/$desc/$tags?desc=long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20long%20desc%20&tags=news,entertainment,fun