First Time User Guide
An overview of interacting with a REST API
Last updated
Was this helpful?
An overview of interacting with a REST API
Last updated
Was this helpful?
(Optional)
There are 3 types of input to our API.
Headers
URL Endpoint
Data (or body)
The base URL is the starting point of the API you’re requesting from. The path specifies which model you are querying.
Base URL for our API: https://api.corsali.com/predict
Path for a specific model: {model_id}
Full url endpoint: https://api.corsali.com/predict/{model_id}
Headers provide authentication information as well as information on what kind of data will be passed in. Our API requires 3 headers:
Click on the link for each header type in order to understand the specifics about each header.
The data contains the information that you will be sending to the API. The formatting of the input data will be different for different models. For formatting of the data:
Look under "Your Models" to see a list of models associated with your organization
Under each model is a "Request Input Data" page that explains the parameters and format of the input data
For most models the input format will be a JSON with a number of parameters passed in.
Open Terminal
Under "Your Models" > "Example Model" > "Request Input Data" find the "Example Input". Copy and pasted into a file and save it in your current path.
This command has already filled in for you the Content-Type, Organization Id and URL with the first model id associated with your account
You will need to paste in your authentication key
Fill in your input data with the name of the file you created
Hit "enter" and send your first API Request!
: Carries credentials containing the authentication information for the model being queried
: Indicates the media type (text/html or text/JSON) of the request
: Specifies the organization to ensure you have permission to access the requested model
Now you are ready to go through the .
There are many different ways to interact with a REST API. The demo uses python code but we provide an example using as well as . Read through one or both of these examples to see how the inputs we defined above are passed into an API request. If you are feeling ambitious and want to run through a cURL request as well continue reading!
If you do not have an authentication key (or lost yours), . Remember to save it to a secure location as it can only be viewed once
Go to this and copy and paste the example command into your terminal. Note it refers to input data as example.json if you named your json something else you must change this.