Messages for C More customers
Endpoints used by clients that need to retrieve or delete messages.
NOTE: All requests to this service must be sent over HTTPS
/messages{?token,client}
Returns a list of messages for the given user.
The token parameter can be sent as an Authorization: Bearer JWT header.
| Name | Description | Required | Type | Example |
|---|---|---|---|---|
| token | JSON Web Token issued by an auth service |
Required | string |
eyJhbGciOiJIUzI…
|
| client | The client type to get messages for |
Required | string |
ios
|
| limit | Max number of messages to return |
integer |
3
|
200
SHOW
< Content-Type: application/json; charset=utf-8{
"meta": {
"endpoint": "/messages/1",
"forwarded_for": "",
"request_id": "17bb92e1-bb7d-497c-a696-1735d6983a25",
"timestamp": "2017-07-25T09:24:08.666752858Z"
},
"data": {
"message": {
"id": "1",
"uid": "-1234",
"body": "test body 2",
"state": "imported",
"type": "test",
"created": "2017-01-01T01:01:01+01:00",
"expires": "2032-01-01T01:01:01+01:00",
"clients": [
"ios",
"android",
"web"
],
"prio": 0
}
}
}
401
SHOW
Returned if unauthorized
500
SHOW
Returned if unable to retrieve messages from the database
/messages/{message_id}{?token}
Update the status of a message to deleted
All messages marked as deleted is synced back to the Adobe Campaign
system by scheduled calls to the /messages/sync endpoint.
The token parameter can be sent as an Authorization: Bearer JWT header.
It is also possible to delete messages using a X-Api-Key.
| Name | Description | Required | Type | Example |
|---|---|---|---|---|
| message_id | Message identifier |
Required | string |
123
|
| token | JSON Web Token issued by an auth service |
Required | string |
eyJhbGciOiJIUzI…
|
204
SHOW
Returned if message was deleted
400
SHOW
Returned if passed invalid message_id
401
SHOW
Returned if unauthorized
404
SHOW
Returned if unable to delete message
Endpoints used primarily by the Adobe Campaign backend.
NOTE: All requests to this service must be sent over HTTPS
/messages/import
You need to provide the X-Api-Key header and send the request over HTTPS.
The request body MUST be a stream of valid JSON documents with \r\n line separators.
Each document needs to be a valid message with the following fields:
| Field | Description | Example | |
|---|---|---|---|
| id | (required) | Message ID, must be unique | "123" |
| uid | (required) | User ID | "1616416" |
| vid | Vman ID | "3003060" |
|
| created | (required) | Created date | "2014-11-06T13:34:59+01:00" |
| expires | (required) | Expires date | "2014-11-10T13:34:59+01:00" |
| title | Title of the message | "Kolla på Hellenius hörna" |
|
| lead | Short lead of the message | "Svensk talkshow…" |
|
| body | (required) | Body of the message | "Svensk talkshow med David Hellenius…" |
| url | URL | "https://www.cmore.se/konto/mitt-konto" |
|
| img | Image URL | "http://aman.production.s3.amazon…" |
|
| clients | (required) | List of target clients | ["web","ios","android","atv","stv"] |
| type | (required) | Type | "campaign" |
| prio | (required) | Priority of the message | 35 |
> Content-Type: application/json; boundary=NL> X-Api-Key: f00bar01234{"id":"123","uid":"456","vid":"3003060","created":"2014-11-06T13:34:59+01:00","expires":"2014-11-10T13:34:59+01:00","title":"Kolla på Hellenius hörna","lead":"Svensk talkshow med David Hellenius.","body":"Svensk talkshow med David Hellenius som träffar kända och aktuella gäster.","img":"http://aman.production.s3.amazonaws.com/506d51dd2c4b61095800014d/fb1024_helleniushorna_2013.jpg","clients":["web","ios","android"],"type":"campaign","prio":35}
{"id":"124","uid":"789","vid":"3003060","created":"2014-11-06T13:34:59+01:00","expires":"2014-11-10T13:34:59+01:00","title":"Kolla på Hellenius hörna","lead":"Svensk talkshow med David Hellenius.","body":"Svensk talkshow med David Hellenius som träffar kända och aktuella gäster.","img":"http://aman.production.s3.amazonaws.com/506d51dd2c4b61095800014d/fb1024_helleniushorna_2013.jpg","clients":["web","ios","android"],"type":"campaign","prio":35}
200
SHOW
Returned if everything went well
400
SHOW
Returned if unable to decode or validate a message to be imported
401
SHOW
Returned if unauthorized
409
SHOW
Returned if bulk import returned an error, duplicate_key is the first duplicate id. New messages are inserted into the database.
{
"meta": {
"duplicate_key": "456",
"endpoint": "/messages/import",
"forwarded_for": "",
"request_id": "",
"timestamp": "2017-06-22T08:18:52.802639367Z"
},
"errors": [
{
"status": 409,
"title": "Conflict",
"detail": "E11000 duplicate key error collection: cmore-messages.messages index: _id_ dup key: { : \"456\" }"
}
]
}
413
SHOW
Returned if the client sent too many messages at once. Default import limit is 25000 messages
/messages/retract
You need to provide the X-Api-Key header and send the request over HTTPS.
The request body MUST be a valid JSON document in the specified format.
The /messages/retract endpoint is used when there is a need to invalidate a list of messages.
> Content-Type: application/json> X-Api-Key: f00bar01234200
SHOW
< Content-Type: application/json; charset=utf-8400
SHOW
Returned if unable to decode the request body
401
SHOW
Returned if unauthorized
404
SHOW
Returned if unable to retract any message in the provided list
/messages/sync{?key}
Used to sync all deleted messages back to the Adobe Campaign system.
This endpoint is automatically triggered by the Temporize Scheduler every 4 minutes.
Example payload (sent to pmserviceSync)
{
"messages":[
{"id":"123"},
{"id":"456"}
]
}
| Name | Description | Required | Type | Example |
|---|---|---|---|---|
| key | The API key used by the sync scheduler. (You may send the X-Api-Key header instead) |
Required | string |
temporize-58648235b0490d0081a942f9
|
200
SHOW
< Content-Type: application/json; charset=utf-8401
SHOW
Returned if unauthorized
404
SHOW
Returned if unable to set the messages to status synced in the database
500
SHOW
Returned if unable to delete messages or perform the sync request
503
SHOW
Returned if sync is disabled
/messages/cleanup{?key}
Scheduled database cleanup. (Removing synced and expired messages from MongoDB)
This endpoint is automatically triggered by the Temporize Scheduler
| Name | Description | Required | Type | Example |
|---|---|---|---|---|
| key | The API key (You may send the X-Api-Key header instead) |
Required | string |
dashboard-9043a0f543e07f7ffa91a388
|
200
SHOW
< Content-Type: application/json; charset=utf-8401
SHOW
Returned if unauthorized
403
SHOW
Returned if requesting endpoint over HTTP
404
SHOW
Returned if not found
500
SHOW
Returned if database was unable to do the cleanup
/messages/{message_id}{?key}
Show any message, requires API key.
| Name | Description | Required | Type | Example |
|---|---|---|---|---|
| message_id | Message identifier |
Required | string |
123
|
| key | The API key (You may send the X-Api-Key header instead) |
Required | string |
client-9043a0f543e07f7ffa91a388
|
200
SHOW
< Content-Type: application/json; charset=utf-8{
"meta": {
"endpoint": "/messages/1",
"forwarded_for": "",
"request_id": "",
"timestamp": "2017-07-25T09:38:34.277120478Z"
},
"data": {
"message": {
"id": "1",
"uid": "-1234",
"body": "test body 2",
"state": "imported",
"type": "test",
"created": "2017-01-01T01:01:01+01:00",
"expires": "2032-01-01T01:01:01+01:00",
"clients": [
"ios",
"android",
"web"
],
"prio": 0
}
}
}
400
SHOW
Returned if passed invalid message_id
401
SHOW
Returned if unauthorized
404
SHOW
Returned if not found in the database
/users/{user_id}/messages{?key}
Update the status of all imported messages for a user to deleted
| Name | Description | Required | Type | Example |
|---|---|---|---|---|
| user_id | User identifier |
Required | string |
234
|
| key | The API key (You may send the X-Api-Key header instead) |
Required | string |
client-9043a0f543e07f7ffa91a388
|
200
SHOW
< Content-Type: application/json; charset=utf-8401
SHOW
Returned if unauthorized