Server API: Server events
What people did, as your servers saw it, and the events your app defines.
| What it does | Route |
|---|---|
| Send a person’s Apple Ads attribution token | POST /server/v1/contacts/{external_id}/apple-ads-attribution |
| Declare your events | PUT /server/v1/event-definitions |
| Send events | POST /server/v1/events |
Send a person’s Apple Ads attribution token
Section titled “Send a person’s Apple Ads attribution token”POST /server/v1/contacts/{external_id}/apple-ads-attribution
Sends the token AAAttribution.attributionToken() gave your app, within a day. PurrCRM asks Apple which Apple Ads campaign brought the person, answers with it, and records it as their apple_ads_attribution event. Set the app up with Apple first. Needs the events scope.
Needs: a server key (Authorization: Bearer crm_sk_…). See Connect your backend.
Parameters
| Name | In | Description |
|---|---|---|
external_id (required) | path | Your id for the person: 1 to 200 characters, the same id your users’ tokens carry as their subject. |
Body (application/json): AppleAdsToken
| Field | Type | Description |
|---|---|---|
token (always) | string |
Answers
| Status | Body | Meaning |
|---|---|---|
| 200 | AppleAdsAttribution | OK |
| 400 | problem | The request could not be read: the problem names the field. |
| 401 | problem | No credential, or one that is not right. |
| 403 | problem | Refused: the app is switched off, or this is not allowed. |
| 404 | problem | Not found, or the part is switched off. |
| 409 | problem | Refused as things stand: the problem says why. |
| 422 | problem | A value that is not right: the problem says which. |
| 429 | problem | Too many requests: wait for Retry-After. |
Declare your events
Section titled “Declare your events”PUT /server/v1/event-definitions
Adds the events your app sends, and their props, so the list lives with your code. It only adds: nothing is deleted or changed, and the same declaration again changes nothing.
Needs: a server key (Authorization: Bearer crm_sk_…). See Connect your backend.
Body (application/json): EventDefinitions
| Field | Type | Description |
|---|---|---|
definitions (always) | array of Definition |
Answers
| Status | Body | Meaning |
|---|---|---|
| 200 | DeclaredEvents | OK |
| 400 | problem | The request could not be read: the problem names the field. |
| 401 | problem | No credential, or one that is not right. |
| 429 | problem | Too many requests: wait for Retry-After. |
Send events
Section titled “Send events”POST /server/v1/events
Up to 500 events a request, each kept or refused on its own. An event’s id is your idempotency key: the same id sent again is kept once.
Needs: a server key (Authorization: Bearer crm_sk_…). See Connect your backend.
Body (application/json): ServerEvents
| Field | Type | Description |
|---|---|---|
events (always) | array of ServerEvent |
Answers