Get customer
GET {{url}}/record?id=xyz789
Retrieve a single customer. To specify the customer you want to retrieve:
* Add a Query parameter named ![pic] [Your website]id
.
Body
PARAM
Key | Datatype | Required | Description |
id
|
string |
HEADERS
Key | Datatype | Required | Description |
RESPONSES
status OK
{
"welcome": "You're using the API Adoption course! Check out the 'data' object below to see the values returned by this API request. Click **Visualize** to see the 'tutorial' guiding you through next steps - do this for every request in the collection!",
"data": {
"record": {
"id": "xCAzUfMGZu",
"phrase": "{{$randomCatchPhrase}}",
"pic": "http://placeimg.com/640/480/people",
"num": 99
}
},
"tutorial": {
"title": "You retrieved a record!",
"intro": "This endpoint retrieves a single record from the database. The request specified a record ID using the query parameter. _The API doesn't really return the record with the id you specified, just a random record._ 🤫",
"steps": [
{
"note": "The request returned the following data:",
"raw_data": {
"record": {
"id": "xCAzUfMGZu",
"phrase": "Optimized clear-thinking open system",
"pic": "http://placeimg.com/640/480/people",
"num": 99
}
}
},
{
"note": "Aside from documentation, one of the best ways to help your users orient themselves with your API is to use meaningful request names. Although this API returns junk data, let's pretend it doesn't. At the top of the request tab, hover over the name `Get item` and click the little pencil icon to edit it. Give the request a more meaningful name of your choice, for example `Get customer` (Postman will autosave)."
},
{
"note": "#### Add descriptions\n\nWith the documentation for the request open on the right, you'll see that you can add a description for the request. Click the text-area with 'Make things easier...' etc in it and enter a request description. You can use markdown, for example:",
"js_code": [
"Retrieve a single customer.",
"",
"_To specify the customer you want to retrieve:_",
"* Add a **Query parameter** named `id`."
]
},
{
"note": "You can **Preview** to see the rendered markdown at any time. **Save** your description. Before you move on, also save the response, choosing **Save Response** > **Save as example**–with the example also named `Get customer`, then return here and **Send** again."
},
{
"note": "#### Dynamic examples\n\nTo make the response a little more interesting, we can use dynamic faker variables to generate random values whenever the example is generated. Back in the `Get customer` example, replace the value of the `data` > `phrase` property with `{{$randomCatchPhrase}}` so that it looks like this: `\"phrase\": \"{{$randomCatchPhrase}}\",`"
},
{
"note": "When you start typing `{{$random`, you'll see that there are lots of different random variables which you can use to make your docs and demos more dynamic. **Save** the example as before. Check out the docs again, following the link to the complete version to see how the different examples render–you can select them from the drop-down list."
},
{
"note": "#### Markdown elements\n\nYou can add links and images to your markdown. To try out an image, grab the URL for the `pic` property in the response JSON and include it in your request docs markdown using the following syntax, saving to see the rendered image:",
"js_code": [
" Curl curl -X GET 'prod-api/record?id=xyz789?id=xyz789' ENDPOINTS |