Product - OgnianApostolov/builderly-api-docs GitHub Wiki

Model

Products product {
    "_id": {
        "autogenerated": "true"
    },
    "name": {
        "type": "string",
        "unique": "true",
        "required": "true"
    },
    "url": {
        "type": "string",
        "unique": "true",
        "required": "true"
    },
    "static_url": {
        "type": "string"
    },
    "ribbon": {
        "type": "string"
    },
    "striked": {
        "type": "string"
    },
    "price": {
        "type": "number",
        "required": "true"
    },
    "description": {
        "type": "string"
    },
    "product_informations": [{
        "name": {
            "type": "string",
            "required": "true"
        },
        "description": {
            "type": "string",
            "required": "true"
        }        
    }],
    "product_options": [{
        "name": {
            "type": "string",
            "required": "true"
        },
        "options": [{
            "option": {
                "type": "string",
                "required": "true"
            }
        }]
    }],
    "published": {
        "type": "boolean", 
        "default": "true"
    },
    "available_for_purchase": {
        "type": "boolean", 
        "default": "true"
    },
    "medias": [{
        "media": {
            "type": "Media._ObjectId"
        }
    }],
    "collection_id": {
        "ref": "Collection._ObjectId"
    },
    "grouping": [{
        "collection_id": {
            "ref": "Collection._ObjectId"
        }
    }],
    "owner_id": {
        "ref": "User._ObjectId",                                     
        "required": "true"
    },
    "qty": {
        "type": "number",
        "default": 1
    },
    "origin_address": {
        "type": "string"
    },
    "selected": {
        "type": "boolean",
        "default": "false"
    },
    "custom_1": {
        "type": "string"
    },
    "custom_2": {
        "type": "string"
    },
    "custom_3": {
        "type": "string"
    },
    "about_page": {
        "ref": "AboutPage_.ObjectId"
    },
    "is_digital": {
        "type": "boolean",
        "default": "false"
    },
    "digital_contents": [{
        "content": {
            "ref": "DigitalContent._ObjectId"
        },
        "option": {
            "type": "string"
        }
    }],
    "suitability_price_plans": [{
        "type": "PricePlan._ObjectId"
    }],
    "isSuitable": {
        "type": "boolean"
    },
    "brand": {
        "type": "string"
    },
    "weight": {
        "type": "number",
        "default": 0
    },
    "reference_id": {
        "type": "string"
    },
    "wildcard_url": {
        "virtual": "true"
    },
    "createdAt": {
        "autogenerated": "true"
    },
    "updatedAt": {
        "autogenerated": "true"
    }
}

Methods

Create new

POST /products req.body required

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

Responses Success - status 201

{}

Error - status 400

{
    error_message
}

Retrieve multiple

GET /products?ionic=true

method: 'GET'
{
    url: 'https://{{your-builderly-domain}}/products?ionic=true',
    headers: {},
    json: true,
    body: {}
}

Responses Success - status 200

[
    {
        title,
        collection,
        page_title,
        products,
        filters,
        advanced_filters,
        additionalFieldsLocales,
        selected_filters,
        originAddress,
        about_page,
        site_name,
        showSortByPrice
    }
]

Error - status 500

{
    error_message
}

Query parameters:

  • sortBy createdAt:-1 (most recent) - used by default createdAt:1 (least recent) custom_1:-1 (custom_field_1 by ascending) custom_1:1 (custom_field_1 by descending) custom_2:-1 (custom_field_2 by ascending) custom_2:1 (custom_field_2 by descending) custom_3:-1 (custom_field_3 by ascending) custom_3:1 (custom_field_3 by descending)
  • collection products/{{your-product-collection-name}}
  • Example usages: /products?ionic=true&collection=products?collection=grouping/Diet&sortBy=price:1 - Get products from collection sort by price ascending. /products?ionic=true - Get all products products

Retrieve single

GET /products/:url?ionic=true

method: 'GET'
{
    url: 'https://{{your-builderly-domain}}/products/{{product.url}}?ionic=true',
    headers: {},
    json: true,
    body: {}
}

Responses Success - status 200

{
    title,
    id,
    name,
    price,
    ribbon,
    striked,
    description,
    medias,
    product_informations,
    product_options,
    collection_id,
    grouping,
    published,
    suggestions,
    publish_date,
    published_by,
    origin_address,
    containers,
    custom_1,
    custom_2,
    custom_3,
    available_for_purchase,
    locales: additionalFieldsLocales,
    comments,
    digital_contents,
    url,
    is_digital,
    payment_methods_safe,
    brand,
    weight
}

Not found - status 404

{}

Error - status 500

{
    error_message
}
  • Example usages: /products/{{product:url}}?ionic=true - Retrives a specific product

Update single

PATCH /products/:id

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

Responses Success - status 200

{ product }

Error - status 400

{
    error_message
}

Not found - status 404

{}

Delete single

DELETE /blogposts/:id

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

Responses Success - status 200

{ product }

Not found - status 404

{}

Error - status 500

{
    error_message
}