Booking - OgnianApostolov/builderly-api-docs GitHub Wiki

Model

Booking booking = {
    "_id": {
        "autogenerated": "true"
    },
    "date": {
        "type": "string"
    },
    "time": {
        "type": "string"
    },
    "organization_name": {
        "type": "string"
    },
    "name": {
        "type": "string",
        "required": "true"
    },
    "firstname": {
        "type": "string"
    },
    "lastname": {
        "type": "string"
    },
    "email": {
        "type": "string",
        "required": "true",
        "trim": "true",
        "lowercase": "true"
    },
    "phone_number": {
        "type": "string",
        "required": "true",
        "trim": "true"
    },
    "address": {
        "type": "string",
        "required": "true"
    },
    "city": {
        "type": "string",
        "required": "true",
        "trim": "true"
    },
    "state": {
        "type": "string",
        "trim": "true"
    },
    "country": {
        "type": "string",
        "required": "true",
        "trim": "true"   
    },
    "zip_code": {
        "type": "string",
        "required": "true",
        "trim": "true"
    },
    "tax_identification_number": {
        "type": "string"
    },
    "notes": {
        "type": "string"
    },
    "service_id": {
        "ref": "Service._ObjectId"
    },
    "staff_member": {
        "ref": "User._ObjectId"
    },
    "coupon": {
        "ref": "Coupon._ObjectId"
    },
    "discount_value": {
        "type": "number",
        "default": 0
    },
    "finalized": {
        "type": "Boolean",
        "default": "false"
    },
    "week_reminder_sent": {
        "type": "boolean"
    },
    "day_reminder_sent": {
        "type": "boolean"
    },
    "createdAt": {
        "autogenerated": "true"
    },
    "updatedAt": {
        "autogenerated": "true"
    }
}

Methods

Create new

POST /bookings?ionic=true req.body required

method: 'POST'
{
    url: 'https://{{your-builderly-domain}}/bookings',
    headers: {},
    json: true,
    body: booking
}

Responses Success - status 201

    booking.id

Error - status 400

{
    error_message
}

Retrieve multiple

GET /bookings

method: 'GET'
{
    uri: 'https://{{your-builderly-domain}}/bookings',
    headers: {
        'Authorization': 'Bearer ' + token
    },
    json: true,
    body: {}
}

Responses Success - status 200

[booking]

Error - status 500

{
    error_message
}
  • Example usages: /bookings - Get all booking articles

Retrieve single

GET /my_bookings/:id

method: 'GET'
{
    url: 'https://{{your-builderly-domain}}/my_bookings/{{booking._id}}',
    headers: {},
    json: true,
    body: {}
}

Responses Success - status 200

    Rendered HTML page

Error - status 500

{
    error_message
}
  • Example usages: /my_bookings/:id - Retrives a specific booking

Update single

PATCH /bookings/:id req.params.id && req.body required

method: 'PATCH'
{
    url: 'https://{{your-builderly-domain}}/bookings/{{booking._id}}',
    headers: {
        'Authorization': 'Bearer ' + token
    },
    json: true,
    body: booking
}

Responses Success - status 200

 booking 

Error - status 400

{
    error: "Invalid updates"
}

Not found - status 404

{}

Delete single

`DELETE /bookings/:id

method: 'DELETE'
{
    uri: 'https://{{your-builderly-domain}}/bookings/{{booking._id}},
    headers: {
        'Authorization': 'Bearer ' + token
    },
    json: true,
    body: {}
}

Responses Success - status 200

  booking 

Not found - status 404

{}

Error - status 500

{
    error_message
}