Content REST-API

Master URI: https://api.bagelstudio.co/api/public Authorization: Added as authorization headers Authorization: Bearer <<API_TOKEN>> Version Header: Accept-Version: v1

Get Items

  • Method: GET
  • Endpoint: /collection/<<collectionID>>/items
  • Sample Response
[{
  "_id": "a1Sdasds324ad3d"
}]
1
2
3

Query Params

  • Pagination:

    • perPage=Number_Per_Page Default: 100
    • pageNumber=Page_Number Default: 1
  • Sort

    • sort=Field_Slug
    • order=ASC or DESC
  • Projection (Note that nested collection fields in a collection will only be returned if projected on)

    • projectOn=name,age
    • projectOff=name,age
  • Querying

    • query=Field_Slug:Comparator:Value

    Note: Query must be url encoded

    OperatorValid with FieldsExample
    =All Fields expect Geo Pointname:=:John
    !=All Fields expect Geo Pointname:!=:John
    regexPlain Text, Rich Text, Number, Linkname:regex:Jo
    >All Fieldsage:>:23
    <All Fieldsage:<:10
    withinGeoPoint Onlylocation:within:<lat,lng,distanceInMeters> i.e location:within:23.222,32.2313,2000

For multiple queries they should be joined with a + or the URL encoded version %2B i.e name:=:John+age:>:12

Get Item

  • Method: GET

  • Endpoint: /collection/<<collectionID>>/items/<<itemID>>

  • Query Params

    KeyValueAction
    everythingtrueFor a reference field, it will return the entire item being referenced.
    nestedIDe.g chapters.2323 or chaptersWill retrieve the nested collection or nested collection item rather than the parent item
    projectOnComma-separated list of field slugs e.g name,ageWill only return the requested field slugs, however metadata fields will always be returned; i.e _id, _lastUpdatedDate and _createdDate
    projectOffComma-separated list of field slugs e.g nameWill remove the requested field slug from the response
  • Sample Response

{
  "_id": "324cd",
  "_lastUpdatedDate": "2021-01-17T15:33:27.739Z",
  "_createdDate":"2021-01-17T15:33:27.739Z",
  "name": "Johnny"
}
1
2
3
4
5
6

Add Item

  • Method: POST
  • Endpoint: /collection/<<collectionID>>/items
  • Sample Response
{
  "id": "234239432"
}
1
2
3

Add Nested Item

  • Method: POST

  • Endpoint: /collection/<<collectionID>>/items/<<itemID>>

  • Query Params

    KeyValueAction
    nestedID (Required)e.g chaptersWill add a item to the nested collection
  • Sample Response

{
  "id": "234239432"
}
1
2
3

Update Item or Nested Item

  • Method: PUT

  • Endpoint: /collection/<<collectionID>>/items/<<itemID>>

  • Query Params

KeyValueAction
settrueCreate item if it doesn't exist, using the itemID for the new items ID
nestedIDe.g chapters.2323 or chaptersWill update a nested item if the nestedID ends with an itemID or if set is true it will create a new item with the id
  • Sample Response
{
  "id": "234239432"
}
1
2
3

Update Individual Fields

CURRENTLY ONLY SUPPORTS REFERENCE FIELDS

Append Item Reference

  • Method: PUT
  • Endpoint: /collection/<<collectionID>>/items/<<itemID>>/field/<<fieldSlug>>
    • Query Params
KeyValueAction
nestedIDe.g chapters.2323Will append the item reference to the nested item
  • Request Body:
{
  "value": "REFERENCE ITEM ID"
}
1
2
3

Remove existing item reference

  • Method: DELETE
  • Endpoint: /collection/<<collectionID>>/items/<<itemID>>/field/<<fieldSlug>>
    • Query Params
KeyValueAction
nestedIDe.g chapters.2323Will append the item reference to the nested item
  • Request Body:
{
  "value": "REFERENCE ITEM ID"
}
1
2
3

Delete Item or Nested Item

  • Method: DELETE
  • Endpoint: /collection/<<collectionID>>/items/<<itemID>>
  • Query Params
KeyValueAction
nestedIDe.g chapters.2323Will delete the nested item

Upload Image or Asset

  • Method: PUT
  • Request Type: multipart/form-data
  • Endpoint: /collection/<<collectionID>>/items/<<itemID>>/image?imageSlug=<fieldSlug>

Form Keys:

  • Alt Text for the image: altText
  • To upload an image from a URL: imageLink
  • To upload the actual image: imageFile

Note: Either imageLink or imageFile must be included but not both

Last Updated:
Contributors: nallon