visual studio code http plugin #api #testing #collaborative - sreeragravindran/references GitHub Wiki
The environment variables can be configured in your VS code settings file: ($HOME/Library/Application\ Support/Code/User/settings.json)
"rest-client.environmentVariables": {
"$shared": {
},
"local": {
"host": "https://api.com",
"client_id": "",
"username":"",
"password":""
},
"ppe": {
"host": "https://api-ppe.com",
"client_id": "",
"username":"",
"password":""
}
}
example usage
@customer_id =trn:uid:95d0ad7a-c16b-4cb1-a91b-2f21ca4d9c27
### get admin token
# @name adminToken
POST {{host}}/v3/api/auth/oauth/v2/token HTTP/1.1
Content-Type: application/json
{
"client_id": "{{client_id}}",
"username": "{{username}}",
"password": "{{password}}"
}
### create resource
POST {{api_host}}/customer/{{customer_id}} HTTP/1.1
Content-Type: application/json
Authorization: Bearer {{adminToken.response.body.access_token}}
{
"id": "1",
"name": "Tom",
"age": "21",
}
references
https://marketplace.visualstudio.com/items?itemName=humao.rest-client
https://dev.to/techwatching/testing-your-api-with-rest-client-h23