Service - OgnianApostolov/builderly-api-docs GitHub Wiki

Model

Service service {
    "_id": {
        "autogenerated": "true"
    },
    "title": {
        "type": "string",
        "required": "true"
    },
    "url": {
        "type": "string",
        "unique": "true",
        "required": "true"
    },
    "static_url": {
        "type": "string"
    },
    "header": {
        "type": "string"
    },
    "description": {
        "type": "string"
    },
    "bookable": {
        "type": "boolean",
        "default": "true"
    },
    "medias": [{
        "media": {
            "ref": "Media._ObjectId"
        }
    }],
    "collection_id": {
        "ref": "Collection._ObjectId",
    },
    "price": {
        "type": "number"
    },
    "online_payment": {
        "type": "boolean",
        "default": "false"
    },
    "start_date": {
        "type": "date"
    },
    "end_date": {
        "type": "date"
    },
    "day_offset": {
        "type": "number",
        "default": 0
    },
    "is_recurring": {
        "type": "boolean",
        "default": "false"
    },
    "max_participants": {
        "type": "number",
        "required": "true"
    },
    "session_duration": {
        "type": "number",
        "required": "true"
    },
    "time_between_sessions": {
        "type": "number",
        "default": 0
    },
    "monday": {
        "active": {
            "type": "boolean",
            "default": "false"
        },
        "hours": [{
            "start": {
                "type": "string"
            },
            "end": {
                "type": "string"
            }
        }]
    },
    "tuesday": {
        "active": {
            "type": "boolean",
            "default": "false"
        },
        "hours": [{
            "start": {
                "type": "string"
            },
            "end": {
                "type": "string"
            }
        }]
    },
    "wednesday": {
        "active": {
            "type": "boolean",
            "default": "false"
        },
        "hours": [{
            "start": {
                "type": "string"
            },
            "end": {
                "type": "string"
            }
        }]
    },
    "thursday": {
        "active": {
            "type": "boolean",
            "default": "false"
        },
        "hours": [{
            "start": {
                "type": "string"
            },
            "end": {
                "type": "string"
            }
        }]
    },
    "friday": {
        "active": {
            "type": "boolean",
            "default": "false"
        },
        "hours": [{
            "start": {
                "type": "string"
            },
            "end": {
                "type": "string"
            }
        }]
    },
    "saturday": {
        "active": {
            "type": "boolean",
            "default": "false"
        },
        "hours": [{
            "start": {
                "type": "string"
            },
            "end": {
                "type": "string"
            }
        }]
    },
    "sunday": {
        "active": {
            "type": "boolean",
            "default": "false"
        },
        "hours": [{
            "start": {
                "type": "string"
            },
            "end": {
                "type": "string"
            }
        }]
    },
    "address": {
        "type": "string"
    },
    "staff_member": [{
        "ref": "User._ObjectId",
    }],
    "owner_id": {
        "ref": "User._ObjectId"
    },
    "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",
    },
    "show_only_about_page": {
        "type": "boolean",
        "default": "false"
    },
    "suitability_price_plans": [{
        "ref": "PricePlane._ObjectId",
    }],
    "isSuitable": {
        "type": "boolean"
    },
    "booking_only": {
        "type": "boolean"
    },
    "dates_disabled": [{
        "type": "string"
    }],
    "wildcard_url": {
        "virtual": "true"
    },
    "createdAt": {
        "autogenerated": "true"
    },
    "updatedAt": {
        "autogenerated": "true"
    }
}

Methods

Create new

POST /services req.body required

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

Responses Success - status 201

{}

Error - status 400

{
    error_message
}

Retrieve multiple

GET /services?ionic=true

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

Responses Success - status 200

[{
    title,
    collection,
    page_title,
    services,
    filters,
    additionalFieldsLocales,
    originAddress,
    showSortByPrice,
    about_page
}]

Error - status 400

{
    error_message
}

Not found - status 404

{}

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)
  • Example usages: /services?ionic=true&collection=service/sortBy=createdAt:-1 - Get services from collection sort by newest. /services?ionic=true - Get all services

Retrieve single

GET /services/:url?ionic=true

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

Responses Success - status 200

{
    title,
    id,
    service,
    comments,
    staff_member,
    medias,
    suggestions,
    publish_date,,
    published_by,
    containers,
    locales
}

Not found - status 404

{}

Error - status 500

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

Update single

PATCH /services/:id

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

Responses Success - status 200

{ service }

Error - status 400

{
    error_message
}

Not found - status 404

{}

Delete single

DELETE /services/:id

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

Responses Success - status 200

{ service }

Not found - status 404

{}

Error - status 500

{
    error_message
}