Inventory - OgnianApostolov/builderly-api-docs GitHub Wiki

Model

Inventory inventory {
    "_id": {
        "autogenerated": "true"
    },
    "product": {
        "ref": "Product._ObjectId"
    },
    "option": {
        "type": "string"
    },
    "quantity": {
        "type": "number",
        "default": 0
    },
    "sku": {
        "type": "string"
    },
    "track": {
        "type": "boolean",
        "default": "false"
    },
    "trackSku": {
        "type": "boolean",
        "default": "false"
    },
    "name": {
        "virtual": "true"
    },
    "media": {
        "virtual": "true"
    },
    "category": {
        "virtual": "true"
    },
    "price": {
        "virtual": "true"
    },
    "status": {
        "virtual": "true"
    },
    "createdAt": {
        "autogenerated": "true"
    },
    "updatedAt": {
        "autogenerated": "true"
    }
}

Methods

Create new

POST /inventory req.body required

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

Responses Success - status 201

{}

Error - status 400

{
    error_message
}

Retrieve multiple

GET /inventory

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

Responses Success - status 200

[inventory]

Error - status 500

{
    error_message
}
  • Example usages: /inventory - Get all records in inventory array

Retrieve single

GET /inventory/:id

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

Responses Success - status 200

{ inventory }

Not found - status 404

{}

Error - status 500

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

Update single

PATCH /inventory/:id

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

Responses Success - status 200

{ inventory }

Error - status 400

{
    error_message
}

Not found - status 404

{}

Delete single

DELETE /inventory/:id

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

Responses Success - status 200

{ inventory }

Not found - status 404

{}

Error - status 500

{
    error_message
}