Order - OgnianApostolov/builderly-api-docs GitHub Wiki

Model

Order order {
    "_id": {
        "autogenerated": "true"
    },
    "organization_name": {
        "type": "string"
    },
    "firstname": {
        "type": "string",
        "required": "true"
    },
    "lastname": {
        "type": "string",
        "required": "true"
    },
    "email": {
        "type": "string",
        "equired": "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"
    },
    "products": {
        "type": "string"
    },
    "products_obj": [{
        "product_id": {
            "ref": "Product._ObjectId"
        },
        "name": {
            "type": "string"
        },
        "options": {
            "type": "string"
        },
        "price": {
            "type": "number"
        },
        "quantity": {
            "type": "number"
        }
    }],
    "value": {
        "type": "number"
    },
    "finalized": {
        "type": "boolean",
        "default": false
    },
    "fulfilled": {
        "type": "boolean",
        "default": "false"
    },
    "paid": {
        "type": "Boolean",
        "default": "false"
    },
    "delivery_method": {
        "type": "string"
    },
    "payment_method": {
        "type": "string"
    },
    "shipping_cost": {
        "type": "number"
    },
    "coupon_code": {
        "type": "string"
    },
    "owner_id": {
        "ref": "User._ObjectId"
    },
    "reference_id": {
        "type": "string"
    },
    "createdAt": {
        "autogenerated": "true"
    },
    "updatedAt": {
        "autogenerated": "true"
    }
}

Methods

Create new

POST /orders req.body required

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

Responses Success - status 200

{}

Error - status 400

{
    error_message
}

Retrieve multiple

GET /orders

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

Responses Success - status 200

[orders]

Error - status 500

{
    error_message
}
  • Example usages: /orders - Get all orders

Retrieve single

GET /orders/:id

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

Responses Success - status 200

{ order }

Not found - status 404

{}

Error - status 500

{
    error_message
}
  • Example usages: /orders/:id - Retrives a specific order

Update single

PATCH /orders/:id

method: 'PATCH'
{
    url: 'https://{{your-builderly-domain}}/orders/{{order._id}}',
    headers: {},
    json: true,
    body: {}
}

Responses Success - status 200

{ order }

Error - status 400

{
    error_message
}

Not found - status 404

{}

Delete single

DELETE /orders/:id

method: 'DELETE'
{
    url: 'https://{{your-builderly-domain}}/orders/{{order._id}}',
    headers: {},
    json: true,
    body: {}
}

Responses Success - status 200

{ order }

Not found - status 404

{}

Error - status 500

{
    error_message
}