Voucher - OgnianApostolov/builderly-api-docs GitHub Wiki
Model
Voucher voucher {
"_id": {
"autogenerated": "true"
},
"title": {
"type": "string"
},
"body": {
"type": "string"
},
"media": {
"ref: Media._ObjectId"
},
"show_to": {
"type": "string",
"default": 0
},
"createdAt": {
"autogenerated": "true"
},
"updatedAt": {
"autogenerated": "true"
}
}
Methods
Create new
POST /vouchers
req.body required
method: 'POST'
{
url: 'https://{{your-builderly-domain}}/vouchers,
headers: {},
json: true,
body: {}
}
Responses
Success - status 201
{}
Error - status 400
{
error_message
}
Retrieve multiple
GET /vouchers
method: 'GET'
{
url: 'https://{{your-builderly-domain}}/vouchers',
headers: {},
json: true,
body: {}
}
Responses
Success - status 200
[ vouchers ]
Error - status 500
{
error_message
}
- Example usages:
/vouchers
- Get all vouchers
Retrieve single
GET /vouchers/:id
method: 'GET'
{
url: 'https://{{your-builderly-domain}}/vouchers/{{voucher._id}}',
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: {}
}
Responses
Success - status 200
{ voucher }
Not found - status 404
{}
Error - status 500
{
error_message
}
- Example usages:
/vouchers/:id
- Retrives a specific voucher
Update single
PATCH /vouchers/:id
method: 'PATCH'
{
url: 'https://{{your-builderly-domain}}/vouchers/{{voucher._id}}',
headers: {},
json: true,
body: {}
}
Responses
Success - status 200
{ voucher }
Error - status 400
{
error_message
}
Not found - status 404
{}
Delete single
DELETE /vouchers/:id
method: 'DELETE'
{
url: 'https://{{your-builderly-domain}}/vouchers/{{voucher._id}}',
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: {}
}
Responses
Success - status 200
{ voucher }
Not found - status 404
{}
Error - status 500
{
error_message
}