How can I convert the following Curl to Ajax Call?
this curl is sending a request to GeoServer to publish all layers with matching names coming from the tables.txt file
for /f %%a in (tables.txt) do curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<featureType><name>%%a</name></featureType>" http://localhost:8080/geoserver/rest/workspaces/cite/datastores/geonode/featuretypes
pause
I have tried the following methods.
await fetch("localhost:8080/geoserver/rest/workspaces/cite/datastores/…", {
method: 'POST',
headers: {
"Content-type": "text/xml"
},
body: {
"<featureType><name>totalpotatoyield2020</name></featureType>": ""
},
auth: {
"user": "admin",
"password": "geoserver"
}
})