New and Improved API (Version 3)

We are please to invite you to try our new and improved API, which is now at version 3. Version 2 of the API is still available and will remain until the end of the year. This new version includes a number of enhancements, mostly on the resquest side.

Version 2 of the API worked perfectly fine, but it wasn’t as simple as it could be. The POST body needed to be wrapped in a JSON object which only contained one field: “parameters”. This made the API calls cumbersome for complex objects. Escaping had to be done, since the parameters field expected an escaped json formatted string.

For example, calling and application method “HelloYou” form the application “HelloWorld” requiring one parameter, would need to be called like this in version 2:

Using curl
1
2
3
4
5
6
curl -X POST \
-H "iKnode-UserId: [YOUR-USERID]" \
-H "iKnode-ApiKey: [YOUR-APIKEY]" \
-H "Content-Type: application/json" \
-d '{ "parameters" : "{ yourName: \"John Doe\" }" }' \
https://api.iknode.com/Applications/execute/HelloWorld/HelloYou

Notice how the parameters are wrapped and escaped in the POST body: ’{ “parameters” : “{ yourName: "John Doe" }” }’

With the new API, the POST body contains your JSON object exactly as you serialized. No need for escaping or encoding. Additionally, the User Identifier is now part of the URL, only the API Key needs to be added in the header.

Using curl
1
2
3
4
5
curl -X POST \
-H "iKnode-ApiKey: [YOUR-APIKEY]" \
-H "Content-Type: application/json" \
-d '{ "yourName": "John Doe" }' \
https://api.iknode.com/v3/[YOUR-USERID]/HelloWorld/HelloYou

Notice the parameters are no longer wrapped, and the JSON parameter is represented as is: { “yourName”: “John Doe” }

Needles to say, that if you are using the SDK, this change doesn’t change anything in your code. The newesst SDKs already support Version 3 of the API. Just upgrade to the latest version of the SDK and you are set to go. No need to change your code.

For more information check the documentation here.