Page 1 of 1

how to define a rest service that post multipart data

Posted: Sat Jun 21, 2014 12:41 pm
by Zhong Liu

Hello,
I need access to a third party web service which accepting multipart form data, how do I define this service using create rest service. in setting tab, what option should I choose for "data type" and "content type"? If the url is for upload a file, what parameters should I give for the request. If possible, please give me an example. Thank you.


how to define a rest service that post multipart data

Posted: Sat Jun 21, 2014 1:29 pm
by Illya Stepanov

Hi Zhong Liu,

This depends to your service settings that you are trying to connect, you should check this in their documentation.

If you needed a custom setting for your service, then the Generic service is the way for you, more information you can find here:
:: http://devcenter.appery.io/documentat...


how to define a rest service that post multipart data

Posted: Mon Jun 23, 2014 3:52 pm
by Zhong Liu

Hi IIIya,
I defined a rest service, and add a datasource on the page like this:

Image

then I put a piece of js code on 'click' event of a button like this:

Image

when I test the app by launch and click the button, the rest service can be called and run successfully, the request parameter can be passed to the rest service.

However, when I define a rest service which is used to upload an image file, the server need a multipart-form data like this:

Image

I don't know how to pass this kind of data to service when calling service_name.execute(); could you please give me your suggestion, thank you!


how to define a rest service that post multipart data

Posted: Mon Jun 23, 2014 7:09 pm
by Evgene Karachevtsev

Zhong,

You may find answer here: https://getsatisfaction.com/apperyio/...