Skip to content

Latest commit

 

History

History
1123 lines (941 loc) · 88.6 KB

cms-api.md

File metadata and controls

1123 lines (941 loc) · 88.6 KB

CMS API:

List of api:

Admin api:

Collection "about"

POST

/api/collections/about/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional title_en
String Plain text value.
Optional vision_en
String Plain text value.
Optional mission_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional vision_ar
String Plain text value.
Optional mission_ar
String Plain text value.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "7l3df7dfab5pbor",
  "collectionName": "about",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "vision_en": "test",
  "mission_en": "test",
  "title_ar": "test",
  "vision_ar": "test",
  "mission_ar": "test"
}

PATCH

/api/collections/about/records/:id

Path Params:
Param Type Description
id String ID of the record to update.

Body:

Field Type Description
Optional title_en
String Plain text value.
Optional vision_en
String Plain text value.
Optional mission_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional vision_ar
String Plain text value.
Optional mission_ar
String Plain text value.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "7l3df7dfab5pbor",
  "collectionName": "about",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "vision_en": "test",
  "mission_en": "test",
  "title_ar": "test",
  "vision_ar": "test",
  "mission_ar": "test"
}

DELETE

/api/collections/about/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null

Collection "specializations"

POST

/api/collections/specializations/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional title_en
String Plain text value.
Optional description_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_ar
String Plain text value.
Optional images
Array<String> (*) Relation record ids of Attachments
Optional attachments
Array<String> (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "z9qut6efyilfspl",
  "collectionName": "specializations",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "description_en": "test",
  "title_ar": "test",
  "description_ar": "test",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

PATCH

/api/collections/specializations/records/:id

Body:
Field Type Description
Optional title_en
String Plain text value.
Optional description_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_ar
String Plain text value.
Optional images
Array<String> (**) Relation record ids of Attachments
Optional attachments
Array<String> (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "z9qut6efyilfspl",
  "collectionName": "specializations",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "description_en": "test",
  "title_ar": "test",
  "description_ar": "test",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

DELETE

/api/collections/specializations/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "organizational_chart"

POST

/api/collections/organizational_chart/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional images
Array<String> (*) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "87j52gvwuakjv6t",
  "collectionName": "organizational_chart",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "title_en": "test",
  "title_ar": "test",
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

PATCH

/api/collections/organizational_chart/records/:id

Body:
Field Type Description
Optional images
Array<String> (**) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "87j52gvwuakjv6t",
  "collectionName": "organizational_chart",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "title_en": "test",
  "title_ar": "test",
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

DELETE

/api/collections/organizational_chart/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "minister_speech"

POST

/api/collections/minister_speech/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional images
Array<String> (*) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "sctld81dlg1u119",
  "collectionName": "minister_speech",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "title_en": "test",
  "title_ar": "test",
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

PATCH

/api/collections/minister_speech/records/:id

Body:
Field Type Description
Optional images
Array<String> (**) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "sctld81dlg1u119",
  "collectionName": "minister_speech",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "title_en": "test",
  "title_ar": "test",
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

DELETE

/api/collections/minister_speech/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "sectors"

POST

/api/collections/sectors/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional image
Array<String> (*) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (*) Relation record ids of Attachments
Required sector
String Values: FoodSafetyAndQuality, FoodSecurity, WaterResources, FishWealth, Livestock, Agriculture
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "0rwu1rxqbcsixb3",
  "collectionName": "sectors",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "image": [
    "RELATION_RECORD_ID"
  ],
  "title_en": "test",
  "title_ar": "test",
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ],
  "sector": "FoodSafetyAndQuality"
}

PATCH

/api/collections/sectors/records/:id

Body:
Field Type Description
Optional image
Array<String> (**) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (**) Relation record ids of Attachments
Required sector
String
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "0rwu1rxqbcsixb3",
  "collectionName": "sectors",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "image": [
    "RELATION_RECORD_ID"
  ],
  "title_en": "test",
  "title_ar": "test",
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ],
  "sector": "FoodSafetyAndQuality"
}

DELETE

/api/collections/sectors/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "ministry_news"

POST

/api/collections/ministry_news/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional cover_image
String (*) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional caption_en
String Plain text value.
Optional caption_ar
String Plain text value.
Optional images
Array<String> (*) Relation record ids of Attachments
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (*) Relation record ids of Attachments
Optional author
Boolean
Optional publish
Boolean
Optional publish_date
String
Optional author_name
String Plain text value.
Optional author_avatar
String (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array. Response: 200
{
  "id": "RECORD_ID",
  "collectionId": "lp30igepz1qhqez",
  "collectionName": "ministry_news",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "cover_image": "RELATION_RECORD_ID",
  "title_en": "test",
  "title_ar": "test",
  "caption_en": "test",
  "caption_ar": "test",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ],
  "author": true,
  "publish": true,
  "publish_date": "2022-01-01 10:00:00.123Z",
  "author_name": "test",
  "author_avatar": "RELATION_RECORD_ID"
}

PATCH

/api/collections/ministry_news/records/:id

Body:
Field Type Description
Optional cover_image
String (**) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional caption_en
String Plain text value.
Optional caption_ar
String Plain text value.
Optional images
Array<String> (**) Relation record ids of Attachments
Optional description_en
String Plain text value.
Optional description_ar
String Plain text value.
Optional attachments
Array<String> (**) Relation record ids of Attachments
Optional author
Boolean
Optional publish
Boolean
Optional publish_date
String
Optional author_name
String Plain text value.
Optional author_avatar
String (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "lp30igepz1qhqez",
  "collectionName": "ministry_news",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "cover_image": "RELATION_RECORD_ID",
  "title_en": "test",
  "title_ar": "test",
  "caption_en": "test",
  "caption_ar": "test",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ],
  "author": true,
  "publish": true,
  "publish_date": "2022-01-01 10:00:00.123Z",
  "author_name": "test",
  "author_avatar": "RELATION_RECORD_ID"
}

DELETE

/api/collections/ministry_news/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "versions"

POST

/api/collections/versions/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional cover
String (*) Relation record ids of Attachments
Optional attachments
Array<String> (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "5utlwblt95cvncs",
  "collectionName": "versions",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "cover": "RELATION_RECORD_ID",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

PATCH

/api/collections/versions/records/:id

Body:
Field Type Description
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional cover
String (**) Relation record ids of Attachments
Optional attachments
Array<String> (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "5utlwblt95cvncs",
  "collectionName": "versions",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "cover": "RELATION_RECORD_ID",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

DELETE

/api/collections/versions/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "visuals"

POST

/api/collections/visuals/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional cover_image
String (*) Relation record ids of Attachments
Optional attachments
String (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "wjgecyxwverdj6c",
  "collectionName": "visuals",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "cover_image": "RELATION_RECORD_ID",
  "attachments": "RELATION_RECORD_ID"
}

PATCH

/api/collections/visuals/records/:id

Body:
Field Type Description
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional cover_image
String (**) Relation record ids of Attachments
Optional attachments
String (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "wjgecyxwverdj6c",
  "collectionName": "visuals",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "cover_image": "RELATION_RECORD_ID",
  "attachments": "RELATION_RECORD_ID"
}

DELETE

/api/collections/visuals/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "acoustics"

POST

/api/collections/acoustics/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional cover_image
String (*) Relation record ids of Attachments
Optional audio
String (*) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional link
String URL address.
Optional publish
Boolean
Optional publish_date
String
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "xdnkjvbvv8c5jmk",
  "collectionName": "acoustics",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "cover_image": "RELATION_RECORD_ID",
  "audio": "RELATION_RECORD_ID",
  "title_en": "test",
  "title_ar": "test",
  "link": "https://example.com",
  "publish": true,
  "publish_date": "2022-01-01 10:00:00.123Z"
}

PATCH

/api/collections/acoustics/records/:id

Body:
Field Type Description
Optional cover_image
String (**) Relation record ids of Attachments
Optional audio
String (**) Relation record ids of Attachments
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional link
String URL address.
Optional publish
Boolean
Optional publish_date
String
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "xdnkjvbvv8c5jmk",
  "collectionName": "acoustics",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "cover_image": "RELATION_RECORD_ID",
  "audio": "RELATION_RECORD_ID",
  "title_en": "test",
  "title_ar": "test",
  "link": "https://example.com",
  "publish": true,
  "publish_date": "2022-01-01 10:00:00.123Z"
}

DELETE

/api/collections/acoustics/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "information_designs"

POST

/api/collections/information_designs/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional cover_image
String (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "2oplca8rjjbl036",
  "collectionName": "information_designs",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "cover_image": "RELATION_RECORD_ID"
}

PATCH

/api/collections/information_designs/records/:id

Body:
Field Type Description
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional cover_image
String (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "2oplca8rjjbl036",
  "collectionName": "information_designs",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "cover_image": "RELATION_RECORD_ID"
}

DELETE

/api/collections/information_designs/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "rules"

POST

/api/collections/rules/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional law_number
String Plain text value.
Optional year
Number Number value.
Optional classification_en
String Plain text value.
Optional classification_ar
String Plain text value.
Optional attachments
Array<String> (*) Relation record ids of Attachments
Required type
String
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "e6mgymg6p1fbvsd",
  "collectionName": "rules",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "law_number": "test",
  "year": 123,
  "classification_en": "test",
  "classification_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ],
  "type": "Law"
}

PATCH

/api/collections/rules/records/:id

Body:
Field Type Description
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional law_number
String Plain text value.
Optional year
Number Number value.
Optional classification_en
String Plain text value.
Optional classification_ar
String Plain text value.
Optional attachments
Array<String> (**) Relation record ids of Attachments
Required type
String
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "e6mgymg6p1fbvsd",
  "collectionName": "rules",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "law_number": "test",
  "year": 123,
  "classification_en": "test",
  "classification_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ],
  "type": "Law"
}

DELETE

/api/collections/rules/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

Collection "marketing"

POST

/api/collections/marketing/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional publish
Boolean
Optional publish_date
String Format: "2022-01-01 10:00:00.123Z"
Optional topic
Array<String> (*) Relation record ids of Topics
Required sector
String Values: Marketing, AgriculturalInvestment, FishInvestment
  • (*): the array accepts only id of records of topics collection so you will need to call POST method of topics collection to create a topic record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "56rlyiyuli6zojz",
  "collectionName": "marketing",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "publish": true,
  "publish_date": "2022-01-01 10:00:00.123Z",
  "topic": [
    "RELATION_RECORD_ID"
  ],
  "sector": "Marketing"
}

PATCH

/api/collections/marketing/records/:id

Body:
Field Type Description
Optional title_en
String Plain text value.
Optional title_ar
String Plain text value.
Optional publish
Boolean
Optional publish_date
String Format: "2022-01-01 10:00:00.123Z"
Optional topic
Array<String> (**) Relation record ids of Topics
Required sector
String Values: Marketing, AgriculturalInvestment, FishInvestment
  • (**): the array accepts only id of records of topics collection so int this case you will need to use a combination of POST - PATCH - DELETE from topics collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "56rlyiyuli6zojz",
  "collectionName": "marketing",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "title_en": "test",
  "title_ar": "test",
  "publish": true,
  "publish_date": "2022-01-01 10:00:00.123Z",
  "topic": [
    "RELATION_RECORD_ID"
  ],
  "sector": "Marketing"
}

DELETE

/api/collections/marketing/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of topics collection to delete records of topics related to current record of marketing collection before it's deletion.

collection "topics"

POST

/api/collections/topics/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional topic_en
String Plain text value.
Optional topic_ar
String Plain text value.
Optional images
Array<String> (*) Relation record ids of Attachments
Optional description_en
String
Optional description_ar
String
Optional attachments
Array<String> (*) Relation record ids of Attachments
  • (*): the array accepts only id of records of attachments collection so you will need to call POST method of attachments collection to create an attachment record then sets the id returned by POST into the array.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "ci8h0c7ixhgn2b9",
  "collectionName": "topics",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "topic_en": "test",
  "topic_ar": "test",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

PATCH

/api/collections/topics/records/:id

Body:
Field Type Description
Optional topic_en
String Plain text value.
Optional topic_ar
String Plain text value.
Optional images
Array<String> (**) Relation record ids of Attachments
Optional description_en
String
Optional description_ar
String
Optional attachments
Array<String> (**) Relation record ids of Attachments
  • (**): the array accepts only id of records of attachments collection so int this case you will need to use a combination of POST - PATCH - DELETE from attachments collection in order to achieve the desired result.
{
  "id": "RECORD_ID",
  "collectionId": "ci8h0c7ixhgn2b9",
  "collectionName": "topics",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "topic_en": "test",
  "topic_ar": "test",
  "images": [
    "RELATION_RECORD_ID"
  ],
  "description_en": "test",
  "description_ar": "test",
  "attachments": [
    "RELATION_RECORD_ID"
  ]
}

DELETE

/api/collections/topics/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null
  • Make sure to call for DELETE api of attachment collection to delete records of attachment before deleting this record.

collection "attachments"

POST

/api/collections/attachments/records

Body:

Field Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Optional url
String Plain text value.
Optional bucket
String Plain text value.
Optional object
String Plain text value.
Optional size
Number Number value.
Optional file_name
String Plain text value.
Optional subject
String Plain text value.
Optional content_type
String Plain text value.

Response: 200

{
  "id": "RECORD_ID",
  "collectionId": "1bp57azl51u4zmw",
  "collectionName": "attachments",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "url": "test",
  "bucket": "test",
  "object": "test",
  "size": 123,
  "file_name": "test",
  "subject": "test",
  "content_type": "test"
}

PATCH

/api/collections/attachments/records/:id

Body:
Field Type Description
Optional url
String Plain text value.
Optional bucket
String Plain text value.
Optional object
String Plain text value.
Optional size
Number Number value.
Optional file_name
String Plain text value.
Optional subject
String Plain text value.
Optional content_type
String Plain text value.
{
  "id": "RECORD_ID",
  "collectionId": "1bp57azl51u4zmw",
  "collectionName": "attachments",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "url": "test",
  "bucket": "test",
  "object": "test",
  "size": 123,
  "file_name": "test",
  "subject": "test",
  "content_type": "test"
}

DELETE

/api/collections/attachments/records/:id

Path Params:
Param Type Description
id String ID of the record to delete.
Response: 204
null

Public API

GET

/api/collections/collection_name/records

Query Parameters:

Param Type Description
page Number The page (aka. offset) of the paginated list (default to 1).
perPage Number Specify the max returned records per page (default to 30).
sort String Specify the records order attribute(s).
Add - / + (default) in front of the attribute for DESC / ASC order. Ex.:
// DESC by created and ASC by id ?sort=-created,id

Supported record sort fields:
@random, id, created, updated, images, title_en, title_ar, description_en, description_ar, attachments

filter String Filter the returned records. Ex.:
?filter=(id='abc' && created>'2022-01-01')

The syntax basically follows the format OPERAND OPERATOR OPERAND, where:

  • OPERAND - could be any of the above field literal, string (single or double quoted), number, null, true, false
  • OPERATOR - is one of:
    • = Equal
    • != NOT equal
    • > Greater than
    • >= Greater than or equal
    • < Less than
    • <= Less than or equal
    • ~ Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard match)
    • !~ NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard match)
    • ?= Any/At least one of Equal
    • ?!= Any/At least one of NOT equal
    • ?> Any/At least one of Greater than
    • ?>= Any/At least one of Greater than or equal
    • ?< Any/At least one of Less than
    • ?<= Any/At least one of Less than or equal
    • ?~ Any/At least one of Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard match)
    • ?!~ Any/At least one of NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard match)

To group and combine several expressions you could use brackets (...), && (AND) and || (OR) tokens.

expand String Auto expand record relations. Ex.:
?expand=relField1,relField2.subRelField
Supports up to 6-levels depth nested relations expansion.
The expanded relations will be appended to each individual record under the expand property (eg. "expand": {"relField1": {...}, ...}).
Only the relations to which the request user has permissions to view will be expanded.
fields String

Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.:

?fields=*,expand.relField.name

* targets all keys from the specific depth level.

In addition, the following field modifiers are also supported:

  • :excerpt(maxLength, withEllipsis?)
    Returns a short plain text version of the field string value.
    Ex.: ?fields=*,description:excerpt(200,true)
skipTotal Boolean If it is set the total counts query will be skipped and the response fields totalItems and totalPages will have -1 value.
This could drastically speed up the search queries when the total counters are not needed or cursor based pagination is used.
For optimization purposes, it is set by default for the getFirstListItem() and getFullList() SDKs methods.

Response: 200

{
  "page": 1,
  "perPage": 30,
  "totalPages": 1,
  "totalItems": 2,
  "items": [ // example from minister_speech collection
    {
      "id": "RECORD_ID",
      "collectionId": "sctld81dlg1u119",
      "collectionName": "minister_speech",
      "created": "2022-01-01 01:00:00.123Z",
      "updated": "2022-01-01 23:59:59.456Z",
      "images": "JSON",
      "title_en": "test",
      "title_ar": "test",
      "description_en": "test",
      "description_ar": "test",
      "attachments": "JSON"
    },
    {
      "id": "RECORD_ID",
      "collectionId": "sctld81dlg1u119",
      "collectionName": "minister_speech",
      "created": "2022-01-01 01:00:00.123Z",
      "updated": "2022-01-01 23:59:59.456Z",
      "images": "JSON",
      "title_en": "test",
      "title_ar": "test",
      "description_en": "test",
      "description_ar": "test",
      "attachments": "JSON"
    }
  ]
}

GET

/api/collections/collection_name/records/:id

Path Param:
Param Type Description
id String ID of the record to view.

Query Parameters:

Param Type Description
expand String Auto expand record relations. Ex.:
?expand=relField1,relField2.subRelField
Supports up to 6-levels depth nested relations expansion.
The expanded relations will be appended to the record under the expand property (eg. "expand": {"relField1": {...}, ...}).
Only the relations to which the request user has permissions to view will be expanded.
fields String

Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.:

?fields=*,expand.relField.name

* targets all keys from the specific depth level.

In addition, the following field modifiers are also supported:

  • :excerpt(maxLength, withEllipsis?)
    Returns a short plain text version of the field string value.
    Ex.: ?fields=*,description:excerpt(200,true)

Response: 200

{  // example from minister_speech collection
  "id": "RECORD_ID",
  "collectionId": "sctld81dlg1u119",
  "collectionName": "minister_speech",
  "created": "2022-01-01 01:00:00.123Z",
  "updated": "2022-01-01 23:59:59.456Z",
  "images": "JSON",
  "title_en": "test",
  "title_ar": "test",
  "description_en": "test",
  "description_ar": "test",
  "attachments": "JSON"
}