Check API introduction
Jéssica Gomes avatar
Written by Jéssica Gomes
Updated over a week ago

Check provides a way for the partners to push the data you want to see in our platform through our Check API. This can be done by adding a bit of custom code to the Content Management System (i.e. Wordpress or something else) you're using on your own infrastructure in order to call our Check API using HTTP requests.

Check offers a workspace-scoped read-write API. Use the API to import fact-checks or automate tasks on Check. The Check API uses GraphQL, which is a query language for APIs. It can be a bit complicated for those who are unfamiliar with it.

To test your API queries, we recommend using GraphiQL, a web interface for GraphQL testing. Get in touch with us at check@meedan.com to get access to GraphiQL.

Read comprehensive documentation of the Check API on Github.

Architecture

Since Check API is a GraphQL API, there is one endpoint URL, which is 'check-api.checkmedia.org/api/graphql' It accepts only POST requests. The GraphQL query is passed as a query parameter to that endpoint.

Authentication

To communicate with the Check API, you’ll need an API token. API tokens on Check are scoped to a specific workspace. To generate an API token, contact us at check@meedan.com, and we’ll send you an API key along with information about your supported languages and statuses. Learn more about authentication and authorization on GitHub.

You can see how to send an authenticated request to the Check API with this curl (command line tool) example. To try it yourself you must replace TOKEN and <your_team_slug> with the API key and slug sent previously:

Being successful with that example, the next step would be to create an item (a fact-check) in Check:

Import fact-checks with the Check API

Check’s API is a convenient tool for importing your organization’s fact-check articles. Note that we’ve deprecated Fetch, a tool for scraping fact-check articles. Instead of Meedan pulling data from organization’s websites, organizations now use the API to import items into Check.

To get started importing items with the Check API:

  • Validate your token.

After receiving your token you can validate the authentication with a simple query that should return the Bot name associated to the token:

curl -X POST \

-H 'X-Check-Token: TOKEN' \

-H 'Content-Type: application/json' \

-H 'X-Check-Team: <your_team_slug>' \

--data '{ "query": "query { me { name } }" }' \

"https://check-api.checkmedia.org/api/graphql"

Note that all API calls need to be authenticated by passing the X-Check-Token header.

  • Now create an item with the API. Use this example query to create an item:

mutation create {

createProjectMedia(input: {

media_type: "Blank", # To be used when there is no media... if there is a media, replace this by either "url" (for link media) or "quote" (for text media)... when "url" is present, creation takes longer because it's going to be parsed

channel: { main: 1 }, # This will make this item be listed under "Imported reports"

set_tags: ["science", "astronomy"], # Array of strings (optional)

set_status: "verified", # One of the statuses supported by the workspace (the identifier, not the label) (optional)

set_claim_description: "Earth is round.",

set_fact_check: {

title: "TRUE: The Earth is round",

summary: "Scientific evidences show that the Earth is round.",

url: "https://en.wikipedia.org/wiki/Earth",

language: "en", # Must be the ISO-361 code of a language supported by the workspace (optional)

publish_report: true # If `true`, it can match incoming tipline queries (optional)

}

}) {

project_media {

id # Use this ID to update the item

full_url # Link to the created item

claim_description {

fact_check {

id # Use this ID to update the fact-check

}

}

}

}

}

You can see a full command line example and the correct mapping between the query structure and what's actually seen on Check in more detail with the following diagram:

  • Once you’ve successfully created an item with the API, implement an API integration with that query for your content management system (Wordpress, for example) to call the Check API when a new article is published.

More…

Check API has many other capabilities. Take a look into our full documentation on Github and send a message to check@meedan.com if you need any support.

Did this answer your question?