1
votes

MobileFirst Platform 6.3

I want to use REST API to administer the runtime environments concerning adapters, applications, devices, audit, transactions, security, and push notifications.

http://www-01.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.apiref.doc/apiref/c_restapi_oview.html?lang=fr

That works fine for Request with method GET. But for Method POST i don't find what information i need to send for adapter deployment or application deployment.

http://www-01.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.apiref.doc/apiref/r_restapi_adapter_post.html?lang=fr

what key/value are needed for Adapter (POST) request?

2

2 Answers

1
votes

The transmitted data in the Adapter POST API must be a multipart/form-data containing as single file the adapter binary. So it is not some key/value JSON payload, it is rather a payload for a binary file upload.

If you know curl, you can send a file named myadapter.adapter this way:

curl -u user:password -i -H "Accept: application/json" -H "Content-Type: multipart/form-data" -X POST http://www.example.com/worklightadmin/management-apis/1.0/runtimes/MyProject/adapters?async=false --form "[email protected]"

Please adapt user, password and server address in this example.

It is similar for the Application POST API, here you send the wlapp file.

For examples of multipart/form-data in general, see http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.

0
votes

You need to specify body rather than parameters, and may need to specify some header information

{ 

 method : 'post',
 path : 'xxxxxxx', 

 headers: {'Content-Type' : 'application/json'}, 
 body : { ... arbitrary data here ... } };

}