Calling the API
In order to call the API you’ll need a few things in place:
- An API key.
- A programming language that can form http get and post requests.
- A model you wish to solve.
[1.] To get an API key you’ll need to register an account through the Icepack client portal. Registration is free and we provide a fair-usage policy for small models and request volumes. If you’re looking to play around with bigger models before you commit to a purchase, feel free to drop us a mail with your use case on info@icepack.co and we’ll see if we can help you out. Note that we don’t save your API key on our system, so it’s up to you to save it somewhere safe. If you’re ever in doubt as to the sanctity of your key, or lose it, you can always disable the tarnished key on the portal and generate a new key. Users on the free tier are limited to a single active key at a time. For a step-by-step guide to signing up see the Client Portal sign-up section.
[2.] Once you’ve signed up and obtained your API Key you’ll be able to call the API. The API is located at the following address: https://api.icepack.ai/. If you pop to this address in a browser you’ll get a message saying invalid authorization header: Needs to have the format 'Authorization: Apitoken <token>' . This is because requests to our API require a token so that we can verify that it’s really you.
The body of the http request should be the serialised protobuf problem envelope described in the Problem envelope section. The Content-Type header should be added to the http request and set to application/protobuf. This is currently the only supported content type on the API. The reason for this is that it ensures client-side validity of the payloads before they sent to us. Protobuf is great, in that, if you can’t serialise it, we won’t be able to de-serialise it. This helps combat many data-configuration issues that are often experienced when handling these kinds of problems.
The last modification to the http request is the inclusion of an Authorization header with the string value: “Apitoken
[3.] The last choice you’ll have to make is what kind of model you want to solve. To see working examples of solvable models in Java, C#, Python and R check out the github repo with the quickstart templates for common languages. Our API is language agnostic so feel free to request an series of examples in your preferred language and we’ll add them to the repo. The examples in this repo also illustrate how to form the headers correctly for the different languages to correctly make the http calls.