I'm creating an extension that automates procedures within Codenvy by using the REST API they provide. However, I'm having trouble with a multipart/form-data POST request. Specically, creating a new factory.
This is my ajax/jquery call:
$.ajax({
type: 'POST',
url: 'https://codenvy.com/api/factory',
data: formData,
processData: false,
contentType: false,
success:function(data) {
callback();
},
error:function(e) {
console.log(e);
}
});
But I get a 409 error with the message:
No factory URL information found in 'factoryURL' section of multipart/form-data
I already posted on Codenvy forums, but the only useful thing I got was a curl command
POST http://domain.com/api/factory?token=$token -H 'Content-Type: multipart/form-data' -F 'factoryUrl={$JSONofFactoryConfig}'
rfc2388 says something about a name field, but I have no idea how to convert the curl name field into an ajax request.
How should I go about adding this "factoryUrl" field to my POST request?
It looks like you are missing factoryUrl in your payload. It should be: