Make a Request
How to make API requests.
Not familiar with API requests? Check out our introduction to requests that breaks them down!
The way you make a request depends on what tool you're using. Our API Explorer helps you build requests in a number of languages.
On this page, we'll walk you through making a request using cURL, a popular free, open-source application for making web requests (among many other things).
1. Choose an endpoint
The endpoint you choose depends on the type of resource you need to work with. For example, if you wanted to create a note, you would choose the notes endpoint, at restapi.rev.io/v1/Notes.
curl https://restapi.rev.io/v1/Notes
2. Select a method
The method you choose depends on how you want to work with the resource. To create your note, you would choose POST.
curl https://restapi.rev.io/v1/Notes \
-X POST
3. Add your parameters
Your parameters give us the details of the action you want to perform. In this case, you'll be telling us how to create your note.
Let's say you want your note to go onto customer 1001 and to read, "This is a test note." You'd need to include values in your request for the body parameters customer_id and body, respectively.
curl https://restapi.rev.io/v1/Notes \
-X POST \
-d '{"customer_id":"1001", "body":"This is a test note."}'
In this example and in most cases, you're submitting the parameters in JSON format, so you'll want to specify a content type of application/json. When submitting PATCH requests requests the content type will be application/json-patch+json.
curl https://restapi.rev.io/v1/Notes \
-X POST \
-d '{"customer_id":"1001", "body":"This is a test note."}' \
-H "Content-Type: application/json"
4. Include authorization information
There are a number of ways you can add authorization information to your requests. In this example, we'll use basic authentication.
To successfully submit this request from your own computer with cURL, you'll need to replace the username, client code, and password placeholders with your actual login details.
curl https://restapi.rev.io/v1/Notes \
-X POST \
-d '{"customer_id":"1001", "body":"This is a test note."}' \
-H "Content-Type: application/json" \
-u username@clientcode:password
Try it out here!
Don't want to download cURL? No problem! You can make test requests right from our API Explorer.
Updated over 1 year ago