How to bind remote data for an API of POST type

Team,

I went through documentation of binding remote data with syncfusion dropdownlist.
I have an existing api of post type (and not get as used in demo).

How to can I set the service url in that case along with post body?

Demo attached.

Attachment: remote_data_bind_8c9c171d.zip

4 Replies 1 reply marked as answer

TU Tuariq September 15, 2020 11:57 AM UTC

Team,

Also which type of adapter to use?
I need to bind with a POST api accepting a body and returning a JSON data

Thanks
Tuariq


JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team September 16, 2020 04:42 PM UTC

Hi Tuariq, 

Greetings from Syncfusion support. 

We have checked your query. We suggest you to use WebApi adaptor to achieve your requirement. Please find the sample below.


 
public dataDataManager = new DataManager({ 
    url: 'https://ej2services.syncfusion.com/production/web-services/api/Employees', 
    adaptor: new WebApiAdaptor, 
    crossDomain: true 
}); 


Kindly check the sample and get back to us if you need any further assistance on this. 

Regards, 
Jeyanth. 



TU Tuariq September 17, 2020 04:41 AM UTC

Jeyanth,

Thanks for the response.
My problem was how to use a web api that is of POST method.
In the solution provided, the api used in demo is still of GET.
Could you please provide a sample of using POST method type API which accepts a request body in request?

Thanks
Tuariq


PM Ponmani Murugaiyan Syncfusion Team September 22, 2020 01:49 PM UTC

Hi Tuariq, 

Thanks for the patience. 

We have prepared sample as per your requirement. Please find the frontend and backend sample below for your reference. 



Kindly check with the above sample. Please get back us if you need further assistance. 

Regards, 
Ponmani M 


Marked as answer
Loader.
Up arrow icon