REST APIs Parameters

Posted By :Kajal Singh |30th January 2019

                                                                                                                            REST API's Parameters

Introduction:-

In this blog, we have discussed the REST API's Parameters. Most of the languages are used common parameters. Parameters are optional you can pass at the end of the URL. It is very important to know when to use Parameters while designing an API.

 

There are four types of parameters 

1. Header Parameters

2. Path Parameters

3. Query Parameters

4. Request Body Parameters.

 

1. Header Parameters:- It is included in the request header. Usually, the header includes authorization parameters that are common at all the endpoints that are why the header parameter is not documented with every endpoint. So, The authorization details in header parameters are documented in the authorization requirements section. If you require unique parameters at the endpoint of the URL then you would document them in the documentation of the parameters within each point.

 

2. Path Parameters:- Path Params are used to identify a specific resource or resources. It is part of the endpoint itself and is not optional. Path Param is denoted by {} curly brackets. But in some other API doc styles used a colon or a different syntax. Path Params is also known as URI Parameters.

For ex- user/{user}/bicycles/{bicycleId}

in this example {user} and {bicycleId} are required Path Parameters.

 

3. Query Parameters:- Query Params are used to sort/filter those resources. It appears after (?) question mark at the endpoint of the URL. The question mark followed by the parameters and their values is referred to as the “query string”. Query string set the parameter one right after the other with an (&)ampersand. It represents the key-value pair.

For ex-?key1=value1&key2=value2

/user/{userId}?name=johnsmith&age=30 

 

4. Request body parameters:- with the help of a POST request you submit a JSON object in the request body its called a request body parameter, and usually, it is represented as JSON.

For ex-

{

“id”: 1

“name”:”johnsmith”,

“age”:30

}

 

Thanks & Regards,


About Author

Kajal Singh

Kajal is very sincere and hardworking. She is positive and a good team player.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us