Create a Customization¶
Create a customization to customize a publication.
Endpoint¶
POST https://api.crowdynews.com/publication/customizations
Request Parameters¶
HEADER FIELD | VALUE DESCRIPTION |
---|---|
Content-Type | The content type of the request body, must be set to application/json . |
QUERY PARAMETER | VALUE DESCRIPTION |
---|---|
access_token | A valid OAuth access token with the correct permission(s). |
REQUEST BODY DATA | VALUE TYPE | VALUE DESCRIPTION |
---|---|---|
name | String | Identifies the customization in a human readable way and must be unique inside a contract. This name can be changed after creation. |
contractId* | String | The resource ID that specifies to which contract this customization belongs. |
type | String | If this is a CSS or JavaScript customization. Must either be 'css' or 'js' . |
data | String | The custom CSS or JavaScript as plain text. |
version | String | Optional. Specifies the customization version. This property defaults to '1' and is auto incremented on each update. |
description | String | Optional. Text that describes the customization. |
active | Boolean | Optional. Specifies if this customization will be processed by the platform. This property defaults to true when omitted. |
* The consumer that wants to create this customization must have access to the specified contract. Otherwise this action is forbidden.
Response Format¶
On success, the HTTP status code in the response header is
201 Created
and the response body will contain a
customization object in JSON format. On error, the header
status code is an error code and the response
body contains an error object.
Example Request¶
Request:
POST https://api.crowdynews.com/publication/customizations?access_token={your access token}
{
"name": "My JavaScript Customization",
"contractId":"565c4df4056e859526e62257",
"type": "js",
"data": "console.log('Hello world!');"
}
Response:
HTTP/1.1 201
{
"_id": "565d4de4046e659546e42253",
"created": "2016-03-22T15:01:49.081Z",
"createdBy": "John Doe",
"lastModified": "2016-03-22T15:01:49.081Z",
"lastModifiedBy": "John Doe",
"active": true,
"name": "My JavaScript Customization",
"contractId":"565c4df4056e859526e62257",
"type": "js",
"data": "console.log('Hello world!');",
"version": "1"
}