Apify Discord Mirror

Updated 5 months ago

Suggestion: JavaScript Fetch Example

At a glance

The community member suggests adding a JavaScript Fetch example to the API Console, as it is the most widely used language. They provide an example code snippet using Fetch. In the comments, another community member responds that the documentation team has this on their roadmap, but it will take some time to implement.

Useful resources
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:

Plain Text
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.
Attachment
Screenshot_2024-05-23_090013.png
o
1 comment
Hey, thanks for suggestion. Our docs teams has this in their roadmap but it'll take some time.
Add a reply
Sign up and join the conversation on Discord