Lists global components. Without limit every match comes back.
Global Components
Components defined once and reused across pages, read in templates through $_globalComponents.
List global components#
GET
/cdna-api/common/global-components
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- GlobalComponent, in the Reference
Parameters
propertiesquery- selector
- The fields and relations to return, such as
{id,name,identifier}. filtersquery- name=value
- Any stored field, or a relation with a dot, such as
parent.id=12. Prefix the name with!,>,<,%or|. Use stored field names exactly as in the model, and comparetotalCountwith the unfiltered list's to confirm a filter applied. orderByquery- string
field:ASCorfield:DESC, comma-separated. Stored fields only.limitquery- integer
- Records per response. There is no default.
offsetquery- integer
- Records to skip.
Example
List global components
GET /cdna-api/common/global-components?limit=2&properties={id,name,identifier} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response
200 OK
{
"result": "success",
"totalCount": 2,
"data": [
{
"id": 5,
"name": "Need help callout",
"identifier": null
},
{
"id": 1,
"name": "Support CTA",
"identifier": "support-cta"
}
]
}
Open in Postman docs Real response from this documentation site
Show a global component#
GET
/cdna-api/common/global-component/{id}
Reads one global component by its id.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- GlobalComponent, in the Reference
Parameters
idpathrequired- integer
- The global component id.
propertiesquery- selector
- The fields and relations to return, such as
{id,name,identifier}.
Example
Show a global component
GET /cdna-api/common/global-component/1?properties={id,name,identifier} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response
200 OK
{
"result": "success",
"data": {
"id": 1,
"name": "Support CTA",
"identifier": "support-cta"
}
}
Open in Postman docs Real response from this documentation site
Create a global component#
POST
/cdna-api/common/global-component
Creates a global component.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
layoutbody- number
- The layout, by id or identifier.
namebody- string
- The name.
revisionsbody- object
- A new revision:
name,layoutandareas, ortextfor a record with a body. Areas left out are empty. categoriesbody- list
- Category ids.
Example
Create a global component
POST /cdna-api/common/global-component HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"layout": 13,
"name": "New global component from API",
"revisions": {
"areas": {
"text": "Sample text",
"margin bottom": 3
}
},
"categories": [
9,
12
]
}
Response
200 OK
{
"result": "success",
"data": {
"globalComponent": {
"areas": [
25,
57
],
"usedInContent": true,
"numUsedInContent": 1,
"lastRevision": 16,
"id": 3,
"name": "New global component from API",
"layout": 13,
"created": "2020-03-11T01:46:56+00:00",
"modified": "2020-03-11T01:46:56+00:00",
"hidden": null
}
},
"message": "The Global Component has been added successfully."
}
Open in Postman docs Saved response from the Postman collection, shortened
Edit a global component#
PUT
/cdna-api/common/global-component/{id}
Changes a global component. Fields left out keep their values.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The global component id.
categoriesbody- list
- Category ids.
Example
Edit a global component
PUT /cdna-api/common/global-component/3 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"categories": [
12
]
}
Response
200 OK
{
"result": "success",
"data": {
"globalComponent": {
"areas": [
25,
57
],
"usedInContent": true,
"numUsedInContent": 1,
"lastRevision": 16,
"id": 3,
"name": "New global component from API",
"layout": 13,
"created": "2020-03-11T01:46:56+00:00",
"modified": "2020-03-11T01:48:43+00:00",
"hidden": null
}
},
"message": "The Global Component has been saved successfully."
}
Open in Postman docs Saved response from the Postman collection, shortened
Delete a global component#
DELETE
/cdna-api/common/global-component/{id}
Deletes a global component.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The global component id.
Example
Delete a global component
DELETE /cdna-api/common/global-component/3 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response
200 OK
{
"result": "success",
"data": [],
"message": "The Global Component has successfully been deleted."
}
Open in Postman docs Saved response from the Postman collection