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);
Source: stackoverflow.com
Related Query
- how to use Fetch GET command with params in react js
- how to use params in meteor mongo query with react router
- I have been trying to use Fetch to get data from an external json file with react but kept getting errors
- How do I get url params with a question mark in react js?
- How to get classname or props from NavLink to use with google tag manager with react and redux in a stateless functional component?
- How to get params from url with React front end and express backend?
- how to write one GET api call using axios instance with and without params in React JS
- How to use refs in React with Typescript
- How to use callback with useState hook in react
- How to use children with React Stateless Functional Component in TypeScript?
- How to use throttle or debounce with React Hook?
- GET with query string with Fetch in React Native
- How to use React Router with Electron?
- How to use Redux's Provider with React
- How to fetch the new data in response to React Router change with Redux?
- How to use jQuery UI with React JS
- How to use shouldComponentUpdate with React Hooks?
- How to use React useRef hook with typescript?
- How to use create-react-app with an older React version?
- How to use React Router with Laravel?
- How to use context api with react router v4?
- How do I use the Firebase onAuthStateChange with the new React Hooks?
- How to deal with query params in react + react-router + flux
- How to get params in component in react router dom v4?
- How to use React with Typescript and SASS
- how to get code coverage in react with react testing library
- how can I use fs in react with electron?
- How do I use local state along with redux store state in the same react component?
- How to use React links when rendering content with dangerouslySetInnerHtml?
- how to use react in Codepen with es6
More Query from same tag
- how to rewrite plain javascript into a react component (foreach)
- what is this when binding to click event
- Handling event method with parameter without inserting parameter
- React js call to a function when enter key is pressed
- (event: MouseEvent<Element, MouseEvent>) => void' is not assignable to type '() => Event'
- gerivedStateFromProps doesn't trigger but componentWillReceiveProps did
- Find First Iteration of Map in React/Javascript
- Store redux-form's dirty prop in redux store
- Find the duplicate string in the array and add an incrementing number at the end
- Abstract component vs. prop passing
- Return different <Input> in a form using a switch to return the Input
- Redux Saga - group similar (but not all) actions into takeLeading / takeLatest
- How to save api response in usestate and pass it react player source
- Subclass component to override event handler?
- Why list disappeared when I remake small part React app to Redux?
- Too many re-renders React error while fetching data from API
- React+JavaScript: How to erase data fields after a successful 200 code from sign up page and redirect to login?
- Using destructuring assignment results to not defined
- React API returns empty
- merging client and server package.json files into one
- In useEffect, do all variables get updated when an update is called?
- Creating an installer for Electron React JS app - reactJS component doesn't load when run after install
- React Authorization Header Not Working
- Highlight text using ReactJS
- ComponentDidUpdate doesn't work
- MongoDB filtering and sorting an array
- Grab data from another component for Recharts
- React Production Build shows 404 on page refresh
- How to use the Color we set in createMuiTheme Function of App.js file in child component in react
- build a proper alignment for a footer