Suggestion: JavaScript Fetch Example

On API Console theres is example using CURL, but theres no example using the most used language in the world which is pure JS Fetch. Adding Fetch example may help users a lot. eg:
const APIFY_TOKEN = "YOUR_APIFY_TOKEN"

var run_inputs = { "location": "New York" }

var url = "https://api.apify.com/v2/acts/9avOmybPQaoW1CDas/run-sync-get-dataset-items?token=" + APIFY_TOKEN
var headers = { "content-type": "application/json" }
var options = { method: "POST", headers, body: JSON.stringify(run_inputs) }

var response = await fetch(url, options).then(res => res.json())
const APIFY_TOKEN = "YOUR_APIFY_TOKEN"

var run_inputs = { "location": "New York" }

var url = "https://api.apify.com/v2/acts/9avOmybPQaoW1CDas/run-sync-get-dataset-items?token=" + APIFY_TOKEN
var headers = { "content-type": "application/json" }
var options = { method: "POST", headers, body: JSON.stringify(run_inputs) }

var response = await fetch(url, options).then(res => res.json())
add another language (PHP, ruby) example might useful to.
No description
1 Reply
adverse-sapphire
adverse-sapphire•12mo ago
Hey, thanks for suggestion. Our docs teams has this in their roadmap but it'll take some time.

Did you find this page helpful?