Citation Formatting Api v2.1: Example

Say you are a book publisher and want to display a citation of the books you sell on each of your Web pages. You can do this very easily with the Citations API.

First, send us a JSON-encoded request structured like below. Please note: This has to be urlencoded.

{
    "key": "[your api key]",
    "source": "book",
    "style": "mla7",
    "book": {
    },
    "pubtype": {
        "main": "pubnonperiodical"
    },
    "pubnonperiodical": {
        "title": "Catcher in the Rye",
        "publisher": "Little, Brown",
        "city": "Boston",
        "year": "1995"
    },
    "contributors": [
        {
            "function": "author",
            "first": "J",
            "middle": "D",
            "last": "Salinger"
        }
    ]
}

We’ll respond with the following JSON-encoded string that you can pick up.

{
    "status": "ok",
    "data": "Salinger, J. D. <u>Catcher in the Rye</u>. Boston: Little, Brown, 1995."
}

And that’s basically it! If you want to receive a citation in two styles, just send two JSON requests.

Example curl call

curl https://api.citation-api.com/2.1/rest/cite --request POST --data '{"key":"[your_key]","source":"book","style":"mla7","book":{},"pubtype":{"main":"pubnonperiodical"},"pubnonperiodical":{"title":"Catcher in the Rye","publisher":"Little, Brown","city":"Boston","year":"1995"},"contributors":[{"function":"author","first":"J","middle":"D","last":"Salinger"}]}'