Im trying to fetch the data through API in my react application I m fetching data of item doctype I’m only getting field names not the data present in it how can I achieve it
MY CODE
useEffect(() => {
const API_KEY = '###########################';
const API_SECRET = '######################';
axios
.get(‘http://IPaddress/api/resource/Item?fields=[“item_name”,“item_group”]’, {
headers: {
‘Authorization’: token ${API_KEY} : ${API_SECRET}
,
‘Content-Type’: ‘application/json’
}
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error("error fetching data: ", error);
});
}, );