Some advanced users may want to send POST/PUT requests in order to scrape forms and API endpoints directly. You can do this by sending a POST/PUT request through ScraperAPI. The return value will be stringified. So if you want to use it as JSON, you will need to parse it into a JSON object.
API ENDPOINT REQUEST
import fetch from'node-fetch';// Replace POST with PUT to send a PUT request insteadoptions = { method:'POST', url:'http://api.scraperapi.com/?api_key=APIKEY&url=http://httpbin.org/post', body:JSON.stringify({ foo:'bar' }), headers: {'Content-Type':'application/json', },}fetch(options).then(response => {console.log(response) }).catch(error => {console.log(error) })//For form dataoptions = { method:'POST', url:'http: //api.scraperapi.com/?api_key=${api_key}&url=http://httpbin.org/post', form: { foo:'bar' }, headers: {'Content-Type':'application/x-www-form-urlencoded', },}fetch(options).then(response => {console.log(response) }).catch(error => {console.log(error) })