score:0

fetch('https://data.gov.il/api/action/datastore_search', {
headers: {'contenttype': 'application/json'},
body: json.stringify(data)
}).then(response => response.json()).then(console.log)

score:0

i succeeded, i just put the ajax command in the react project and it's worked

score:1

here is an example on how to use fetch, this example use json placeholder

fetch("https://jsonplaceholder.typicode.com/todos/1", {
  headers: { contenttype: "application/json" },
})
  .then((response) => response.json())
  .then(console.log);

for your code it might be something like this but, unfortunatly the api you are requesting requires access token, so its not tested:

var data = {
  resource_id: '5f5afc43-639a-4216-8286-d146a8e048fe', // the resource id
};
fetch("https://data.gov.il/api/action/datastore_search", {
  headers: { contenttype: "application/json" },
  body: json.stringify(data);
})
  .then((response) => response.json())
  .then(console.log);


Related Query

More Query from same tag