var myHeaders = new Headers();
myHeaders.append(“Authorization”, “BearereyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vYWdyaWJyaWRnZXNlcnZlci5sb2NhbC9hcGkvdjEvZmFybWVyLWxvZ2luIiwiaWF0IjoxNjkyNjEwMzQ4LCJleHAiOjE2OTI2NTM1NDgsIm5iZiI6MTY5MjYxMDM0OCwianRpIjoiYkJVYmc4QWpLTnM3a1RwViIsInN1YiI6IjI4NDkiLCJwcnYiOiI5OWYyM2ExMDBkYWIyOWRiY2U5ODEwOWQyMWJiNTU0ZDJkZWQyYjg5In0.gduTzy5sPRDs7CBKXWjkEY80gYJlZsilAPQNA8tFPXA”);
var formdata = new FormData();
formdata.append(“crop_name”, “Paddy”);
formdata.append(“crop_variety”, “Hybrid-SR 20”);
formdata.append(“sowing_date”, “2023-08-17”);
formdata.append(“harvest_date”, “2024-03-17”);
formdata.append(“org_id”, “331”);
formdata.append(“flu_id”, “2872”);
var requestOptions = {
method: ‘POST’,
headers: myHeaders,
body: formdata,
redirect: ‘follow’
};
fetch(“http://agribridgeserver.local/api/v1/farmer-app/add-crop-allocation”, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log(‘error’, error));
Please follow and like us: