Quick examples of API requests
If you're looking to make some API requests, here are a few examples to help you get started. Remember, you'll need to set up your server to make these requests - this is just for illustration purposes. To get started, let's look at a simple example.
Suppose we want to get information about the latest users on our site. We can do this by making a GET request to the /users endpoint:
In this example, we're using REST API to demonstrate how API calls are being accessed.
This will return a JSON object containing information about the latest users.
GET
/
Request Body
Name | Type | Description |
---|---|---|
id* | 456 |
method URL GET /users
This will return a JSON object containing information about the latest users.
Now let's say we want to get information about a specific user. We can do this by making a GET request to the /users/{id} endpoint, where {id} is the id of the user we want to retrieve:
method URL GET /users/123
This will return a JSON object containing information about the user with id 123.
We can also create new users by making a POST request to the /users endpoint. For example, to create a new user with the name "John Doe" and has filled all the required parameters for the server to accept your request, we would make the following request:
method URL POST /users
The server would then accept your request and send back a response with a status code 200 (means the request has been successful) and in this case would send back a generated id of the user-created by this request as shown below:
Last updated