{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"JSONP Requests ('callback')","type":"basic","slug":"jsonp-callbacks","excerpt":"All of our API routes/endpoints support JSONP callbacks.","body":"If you need to receive your API response wrapped inside a JSONP callback function, you can use the `callback` query parameter with any valid API route. The data will be returned wrapped in the callback function you specify.\n\nThe `callback` value can be any valid JavaScript method name. \n\nThe entire JSON API response will be delivered wrapped in the requested callback function.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example JSONP Query\"\n}\n[/block]\n**Request URL:** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://openexchangerates.org/api/latest.json\\n    ?app_id=[[app:app_id]]\\n    &callback=myCallbackFunction\\n\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\n**JSONP Response: **\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"myCallbackFunction({\\n    \\\"disclaimer\\\": \\\"[...]\\\",\\n    \\\"license\\\": \\\"[...]\\\",\\n    \\\"timestamp\\\": 1346874992,\\n    \\\"base\\\": \\\"USD\\\",\\n    \\\"rates\\\": {\\n        /* ... */\\n    }\\n})\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","updates":[],"order":5,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"566b51a3f46dc90d009de82a","category":{"sync":{"isSync":false,"url":""},"pages":["566b5afcec4a320d00a8ca76","566b63213d25d00d0066b00a","56a47942e5e9190d00ad6200","56a480315fb2530d00421b75","56a489ae9093960d00f9ab31"],"title":"Extra Parameters","slug":"extra-parameters","order":2,"from_sync":false,"reference":true,"_id":"566b59110506f40d0034f148","__v":5,"project":"55312174c68f493900aebb3f","version":"55312174c68f493900aebb42","createdAt":"2015-12-11T23:15:29.864Z"},"githubsync":"","project":"55312174c68f493900aebb3f","version":{"version":"0.7","version_clean":"0.7.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["55312175c68f493900aebb43","566b431d03b4b20d00d02c3a","566b58f212bc0517005d3068","566b59110506f40d0034f148","566b7cc94d1a4d0d00801c00","566b82d130cdb417008d217d","566b855b4d1a4d0d00801c04","566b856f03870a0d008ee7a7","566c42d2f0a5dc0d009acbab","566c443d85dc790d0062c134"],"_id":"55312174c68f493900aebb42","project":"55312174c68f493900aebb3f","releaseDate":"2015-04-17T15:06:28.598Z","__v":10,"createdAt":"2015-04-17T15:06:28.598Z"},"createdAt":"2015-12-11T22:43:47.409Z","user":"5531215e29603d2300011341","__v":5,"parentDoc":null}

JSONP Requests ('callback')

All of our API routes/endpoints support JSONP callbacks.

If you need to receive your API response wrapped inside a JSONP callback function, you can use the `callback` query parameter with any valid API route. The data will be returned wrapped in the callback function you specify. The `callback` value can be any valid JavaScript method name. The entire JSON API response will be delivered wrapped in the requested callback function. [block:api-header] { "type": "basic", "title": "Example JSONP Query" } [/block] **Request URL:** [block:code] { "codes": [ { "code": "https://openexchangerates.org/api/latest.json\n ?app_id=[[app:app_id]]\n &callback=myCallbackFunction\n", "language": "http" } ] } [/block] **JSONP Response: ** [block:code] { "codes": [ { "code": "myCallbackFunction({\n \"disclaimer\": \"[...]\",\n \"license\": \"[...]\",\n \"timestamp\": 1346874992,\n \"base\": \"USD\",\n \"rates\": {\n /* ... */\n }\n})", "language": "json" } ] } [/block]