September 28, 2017

On-the-fly auditing with the ContentKing API

Search engines crawl the web continuously, 24/7 and 365 days per year. So if you want to catch and remedy issues and unexpected changes before they hurt you, you need your tooling to do the same. That’s why today we’re introducing the ContentKing API.

ContentKing does a great job at assessing which pages to crawl when. But the brand new API takes that even further—integrating our API into your publishing workflow triggers priority auditing of the page you’re working on for on-the-fly change tracking. Make a change to your page and instantly see the results in ContentKing.

Yes, this is an absolute game changer and it’s features like this that make us so excited to be leading the field of SEO auditing into a new era!

Integrating the ContentKing API

Integration is relatively simple, but you’re going to want to involve someone with a developer background. Make sure to send them the link to this article to help them on their way. And if they run into trouble, our support team is more than happy to assist!

ContentKing API – how to integrate it

Retrieving your API token

First you’ll need to get your ContentKing account’s API token. You’ll find it in the Account section, under the Team Profile tab.

API endpoint

The overall idea here is that every time you make a change through your CMS, such as adding, deleting, or changing a page, you need your website to call the ContentKing API. You do this using a POST-request to the following endpoint:

POST https://api.contentkingapp.com/v1/check_url

Read on to learn exactly what payload to send.

API request headers

When making a request you need to send along the following request headers:

Authorization: token <place-your-API-token-here>
Content-Type: application/json

Note: you need to provide the string “token” followed by a space and your actual API token.

API request body

Then, as the body of the request, you need to send a JSON object containing the full URL you want ContentKing to check:

{
“url”: “https://www.example.com/url-to-check/”
}

Note: don’t forget to include the domain name and protocol (http or https) in your request.

API return codes

After sending the call, the ContentKing API will reply with one of the following responses:

Successfully processed

200 OK

{
“status” : “ok”
}

This response means that the request was successfully processed and that the page will be checked immediately.

Authorization missing

401 Unauthorized

{
“code”: “auth_missing_token”,
“message”: “Authentication token must be passed in Authorization HTTP header.”,
“errors”: []
}

This response means that the request was received, but that it’s lacking an authorization token and can therefore not be processed. Make sure to correctly set the Authorization header.

Authorization failed

401 Unauthorized

{
“code”: “auth_failed”,
“message”: “Authentication token is expired or invalid.”,
“errors”: []
}

If you get this response it means that the request could not be processed because the supplied API token is invalid or expired.

Authorization malformed

422 Unknown Status

{
“code”: “auth_malformed”,
“message”: “Authorization HTTP header must conform to format described in docs.”,
“errors”: []
}

This response means that the request was received, but that the authorization wasn’t formatted correctly. Make sure to correctly set the Authorization header.

Invalid URL

400 Bad Request

{
“code”: “invalid_url”,
“message”: “Invalid url format provided.”,
“errors”: []
}

If you receive this response it means that you sent an incorrectly formatted URL. Double-check that you sent a fully qualified URL, including the domain name and protocol.

Unknown website

400 Bad Request

{
“code”: “unknown_website”,
“message”: “Website isn’t registered in CK account.”,
“errors”: []
}

When you get this response, the website you’re requesting for doesn’t exist in the ContentKing account belonging to the API token.

Need some help with integrating our API?

In case you or your developer need any help with integrating the API don’t hesitate to reach out. We’re always happy to help!

Ready to try ContentKing?

Finally understand what’s really happening on your website.
Please enter a valid domain name (www.example.com).