API Reference

Entity Events

The record events that start a job: a kind of record created, changed, deleted or completed.

Entity Events in Postman

About entity events

An entity event starts its job when a record of one type fires one event, optionally only for one record or the children of one parent. Entity events always queue the run; they never fire from command-line scripts.

List a job’s entity events#

GET /cdna-api/hooks/entity-events/{hook.id}

Lists the entity events that start one job.

Access
Admin users and integrations, with an OAuth access token or an API key.
Model
EntityEvent, in the Reference

Parameters

hook.idpathrequired
integer
The job id.
propertiesquery
selector
The fields and relations to return, such as {id,entity,method,recordId,parentRecordId}.
filtersquery
name=value
Any stored field, or a relation with a dot, such as method=UpdateRecord. Prefix the name with !, >, <, % or |. Use stored field names exactly as in the model, and compare totalCount with the unfiltered list's to confirm a filter applied.
orderByquery
string
field:ASC or field:DESC, comma-separated. Stored fields only.
limitquery
integer
Records per response: 100 when left out, at most 500. A larger value answers 400.
pagequery
integer
The page to return, counting from 1. offset works too.

Example

List a job’s entity events
GET /cdna-api/hooks/entity-events/2?limit=2&properties={id,entity,method,recordId,parentRecordId} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "totalCount": 1,
  "data": [
    {
      "id": 2,
      "entity": "Documentation\\Entities\\Page",
      "method": "UpdateRecord",
      "recordId": null,
      "parentRecordId": null
    }
  ]
}
Open in Postman docs Real response from this documentation site

Show an entity event#

GET /cdna-api/hooks/entity-event/{id}

Reads one entity event by its id.

Access
Admin users and integrations, with an OAuth access token or an API key.
Model
EntityEvent, in the Reference

Parameters

idpathrequired
integer
The entity event id.
propertiesquery
selector
The fields and relations to return, such as {id,entity,method,recordId,parentRecordId}.

Example

Show an entity event
GET /cdna-api/hooks/entity-event/2?properties={id,entity,method,recordId,parentRecordId} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "data": {
    "id": 2,
    "entity": "Documentation\\Entities\\Page",
    "method": "UpdateRecord",
    "recordId": null,
    "parentRecordId": null
  }
}
Open in Postman docs Real response from this documentation site

Create an entity event#

POST /cdna-api/hooks/entity-event/{hook.id}

Adds an entity event to a job. The example starts the job when a submission of form 7 is completed.

Access
Admin users and integrations, with an OAuth access token or an API key.
Returns
The new entity event under data.entityEvent, and a message.

Parameters

hook.idpathrequired
integer
The job id.
retrieveUnpublishedquery
1
Needed while the job is unpublished, unless the admin shows unpublished records: without it the job is not found.
entitybody
string
The record class, such as Blogs\Entities\Post.
methodbody
string
The event: one of the names List the events a record type fires returns, such as CreateRecord or Completed.
recordIdbody
integer
One record of that type; left out, any record.
parentRecordIdbody
integer
The record’s parent, such as a form’s id for its submissions.
propertiesbody
string
For UpdateRecord: a selector of the fields to capture before the change, so the job can compare.

method is not checked when it is saved. A name the record type does not fire, such as create instead of CreateRecord, is stored and never starts the job. Take the value from List the events a record type fires.

Example

Create an entity event
POST /cdna-api/hooks/entity-event/12 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json

{
  "entity": "Forms\\Entities\\FormSubmission",
  "method": "Completed",
  "parentRecordId": 7
}

Edit an entity event#

PUT /cdna-api/hooks/entity-event/{id}

Changes an entity event. Fields left out keep their values.

Access
Admin users and integrations, with an OAuth access token or an API key.
Returns
The saved entity event under data.entityEvent, and a message.

Parameters

idpathrequired
integer
The entity event id.
methodbody
string
The event: one of the names List the events a record type fires returns, such as CreateRecord or Completed.

method is not checked when it is saved. A name the record type does not fire, such as create instead of CreateRecord, is stored and never starts the job. Take the value from List the events a record type fires.

Example

Edit an entity event
PUT /cdna-api/hooks/entity-event/14 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json

{
  "method": "UpdateRecord"
}

Delete an entity event#

DELETE /cdna-api/hooks/entity-event/{id}

Deletes an entity event.

Access
Admin users and integrations, with an OAuth access token or an API key.

Parameters

idpathrequired
integer
The entity event id.

Example

Delete an entity event
DELETE /cdna-api/hooks/entity-event/14 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json