How do you programmatically publishing a new feature service from an existing one?
In my app I would like to enable users with appropriate privileges to publish a new feature service by using an existing feature service url.
I use a network request which partially looks like this:
NetworkRequest {
id: createServiceNetworkRequest
method: "POST"
url: portalUrl + "/sharing/rest/content/users/" + username + "/publish"
responseType: "json"
The body of the request looks something like this:
{"access":"","description":"","f":"json","fileType":"featureService","itemid":"<<itemid of source feature service>>","name":"My New Feature Service","publishParameters":{"sourceUrl":"<<url to source feature service>>},"snippet":"A new feature service","tags":"my tag","token":"<<my valid token>>"}
But the response comes back as follows:
"{\"error\":{\"code\":400,\"message\":\"Unable to publish item.\",\"details\":[\"'publishParameters' must be specified.\"]}}"
Clearly I am not forming the request correctly. Or perhaps there is an entirely different means to this end? How should I be doing this?
Thanks,
Ken