Make REST API call
In REST API calls, include the URL to the API service for the environment:
Sandbox:
https://sandbox-api.aharooms.com/v1
Live:
https://api.aharooms.com/v1
Parameters
There are three main categories of parameters for each endpoint in the Partner API: route, query string and request body. Note that some endpoints may not have all three categories.
Route Parameters
In the URL of an API endpoint, we include resource name and resource unique identifiers to help users figure out how to structure the requests. Below is an example:
curl -i "https://api.aharooms.com/v1/rooms/10000"
Here rooms
is resource name and 10000
is the resource identifier. Resource names are immutable, but resource identifiers are required, so you need to change the identifier for different resources.
Query String Parameters
API methods may take additional parameters. For GET
request, any parameters excepting ones inside the path segment (route parameters) can be passed as an HTTP query string. These parameters can be used for filtering, pagination and partial responses.
curl -i "https://api.aharooms.com/v1/rooms?status=Listed"
For partial responses, we typically use the term includes to define what additional attributes should be included in the JSON response. You will see that in a lot of API endpoints. By using this method, we create the flexibility when fetching information about resources.
Request Body Parameters
For POST
, PATCH
, PUT
, DELETE
requests, parameters excepting ones included in the URL should be encoded as JSON with content type of application/json
.
HTTP Redirection
Some API endpoints use HTTP redirection when appropriate, and the client should folow the redirection. The redirection responses will contain a Location
header indicating the URI of the resource to which the client should repeat the requests.
Status Code
Description
301
Permanent redirection. The request URI has been superseded by the URI in the Location
header field. The current and future requests will be directed to the new URI.
302
Temporary redirection. The request should be repeated verbatim to the URI specified in the Location header field but clients should continue to use the original URI for future requests.
HTTP Verbs
Here are the list of HTTP verbs used in API endpoints
Verb
Description
GET
Used fro retrieving resources
POST
Used for creating new resources
PATCH
Used for partially updating resources
PUT
Used for replacing resources or collections
DELETE
Used for deleting resources
Response Status Codes
When Aharooms Partner API receives requests to API endpoints, a number of different HTTP status codes might be returned in the response to the original requests.
Status Code
Description
200 OK
The request has been successfully processed.
201 Created
The request has been processed and new resource has been created.
202 Accepted
The request has been accepted but not processed yet.
301 Moved Permanently
Permanent redirection. The request URI has been superseded by the URI in the Location header field. The current and future requests will be directed to the new URI.
302 Found
Temporary redirection. The request should be repeated verbatim to the URI specified in the Location header field but clients should continue to use the original URI for future requests.
400 Bad Request
The request was not understood by the server, generally due to bad syntax or invalid headers.
401 Unauthorized
The authentication credentials are not provided in the request.
403 Forbidden
The server is refusing the response to the request. This is generally because of invalid token scope or not enough permissions.
404 Not Found
The request requested an unknown resource.
422 Unprocessable Entity
The request body is well-formed but contains semantical errors, generally validation errors.
429 Too Many Requests
The request was rejected because the application has exceeded the rate limit.
500 Internal Server Error
An internal error occurred.
501 Not Implemented
The requested endpoint is not available or reserved for future use.
503 Service Unavailable
The server is currently unavailable.
504 Gateway Timeout
The request could not complete in time. You should try to break it down to multiple smaller requests.
Last updated
Was this helpful?