API: Rest Create Article

The Create Articles command allows you to define and create a new article of content to send to Contacts.  The command allows you to specify several components of a article, such as name, description, author email, author name, title, author bio, deck, callout, and body. 

POST /articles

https://[siteurl]/rest/articles

Request Body Parameters

The Create Articles command requires the following in the Posted JSON in order to create a template:

  • Name:"name": "[Article Name]"

  • Body: "body": "[Article Body]"

All other POST-able fields are optional:

  • Article Description: "description": "[Description]"

  • Author email: "authorEmail": "[authorEmail]"

  • Author name: "authorName": "[authorName]"

  • Title: "title": "[Title]"

  • Author bio: "authorBio": "[authorBio]"

  • Deck: "dek": "[Deck]"

  • Callout: "callout": "[callout]"

Request Body Example

Using Create Template with all arguments, line breaks in JSON for readability:

curl --location 'https://api.whatcounts.net/rest/articles' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--header 'Cookie: ' \
--data '{
	"name": "Name",
	"description": "creating an article via rest api",
    "authorEmail": "authorEmail",
    "authorName": "authorName",
    "title": "Title",
    "authorBio": "authorBio",
    "dek": "Dek",
    "callout": "callout",
	"folderId": 0,
    "body": "Body",
    "parentArticleId": 0
}'


Response Body

The response returns all API available Template Properties in JSON format.  Based on the example above, the response returns:

{
    "skip": 0,
    "max": 0,
    "articleId": 335,
    "realmId": 1,
    "name": "Name",
    "description": "creating an article via rest api",
    "authorEmail": "authorEmail",
    "authorName": "authorName",
    "title": "Title",
    "createdDate": "Mar 20, 2024 12:32:04 PM",
    "updatedDate": "Mar 20, 2024 12:32:04 PM",
    "folderId": 0,
    "authorBio": "authorBio",
    "dek": "Dek",
    "callout": "callout",
    "body": "Body",
    "parentArticleId": 0,
    "dto": {
        "skip": 0,
        "max": 0,
        "articleId": 335,
        "realmId": 1,
        "name": "Name",
        "description": "creating an article via rest api",
        "authorEmail": "authorEmail",
        "authorName": "authorName",
        "title": "Title",
        "createdDate": "Mar 20, 2024 12:32:04 PM",
        "updatedDate": "Mar 20, 2024 12:32:04 PM",
        "folderId": 0,
        "authorBio": "authorBio",
        "dek": "Dek",
        "callout": "callout",
        "body": "Body",
        "parentArticleId": 0,
        "childCount": 0
    }
}

Error Response

Error Response Codes include both Client Errors (4xx) and Server Errors (5xx).  Descriptions of each can be found in Response Codes