Blog articles - OgnianApostolov/builderly-api-docs GitHub Wiki

Model

BlogPost blogpost = {
    "_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",
        "required": "true"
    },
    "medias": [{
        "media": {
            "type": "Media_ObjectId"
        }
    }],
    "published": {
        "type": "boolean",
        "default": "true"
    },
    "owner_id": {
        "ref": "User._id"
    },
    "collection_id": {
        "ref": "Collection._id"
    },
    "selected": {
        "type": "boolean",
        "default": "false"
    },
    "custom_1": {
        "type": "string"
    },
    "custom_2": {
        "type": "string"
    },
    "custom_3": {
        "type": "string"
    },
    "about_page": {
        "ref": "AboutPage._ObjectId"
    },
    "suitability_price_plans": [{
        "ref": "PricePlan._ObjectId"
    }],
    "isSuitable": {
        "type": "boolean"
    },
    "reference_id": {
        "type": "string"
    },
    "wildcard_url": {
        "virtual": "true"
    },
    "createdAt": {
        "autogenerated": "true"
    },
    "updatedAt": {
        "autogenerated": "true"
    }
}

Methods

Create new

POST /blogposts req.body required

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

Responses Success - status 201

{}

Error - status 400

{
    error_message
}

Retrieve multiple

GET /blogposts?ionic=true

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

Responses Success - status 200

[{
    title,
    blogposts,
    collection,
    additionalFieldsLocales,
    page_title,
    filters,
    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)
  • collection blogpost/{{your-blog-collection-name}}
  • Example usages: /blogposts?ionic=true&collection=blogpost/News&sortBy=createdAt:-1 - Get blog articles from collection "News" and sort by newest. /blogposts?ionic=true - Get all blog articles

Retrieve single

GET /blogposts/:url?ionic=true

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

Responses Success - status 200

{
    id,
    title,
    collection,
    url,
    header,
    description,
    medias,
    owner,
    created,
    custom_1,
    custom_2,
    custom_3,
    comments,
    suggestions,
    locales,
    containers
}

Not found - status 404

{}

Error - status 500

{
    error_message
}
  • Example usages: /blogposts/my-blog-article?ionic=true - Retrives a specific blogpost

Update single

PATCH /blogposts/:id?ionic=true

method: 'PATCH'
{
    uri: 'https://{{your-builderly-domain}}/blogposts/{{blogpost._id}}?ionic=true',
    headers: {
        'Authorization': 'Bearer ' + token
    },
    json: true,
    body: blogpost
}

Responses Success - status 200

{ blogpost }

Error - status 400

{
    error_message
}

Not found - status 404

{}

Delete single

DELETE /blogposts/:id?ionic=true

method: 'DELETE'
{
    uri: 'https://{{your-builderly-domain}}/blogposts/{{blogpost._id}}?ionic=true',
    headers: {
        'Authorization': 'Bearer ' + token
    },
    json: true,
    body: {}
}

Responses Success - status 200

{ blogpost }

Not found - status 404

{}

Error - status 500

{
    error_message
}