Formatting JSON to match WebApiAdaptor

I'm trying to use the WebApiAdaptor to populate a combobox's text and value with fields from a minimal API I have running on AWS.  I've seen the code you have here:

https://ej2.syncfusion.com/aspnetcore/documentation/combo-box/data-binding/

But no matter what I do, I can't get it to work.  You have some code on your site suggesting I need to have "Items" and "Count" for the JSON to work, e.g., 

{ Items [ "field1" : "value1", "field2" : "value2" } ], Count: 1 }

But when I look at your own API that you are using in your demo, you don't have it set up that way ( https://ej2services.syncfusion.com/production/web-services/api/Employees ).

If I just copy paste the code you have for the WebApiAdaptor demo into my project, it works and populates fields from your API.  Here is the code you have for the demo.  

So this works:

        <ejs-combobox id="persons" placeholder="Select a Person">

  <e-data-manager adaptor="WebApiAdaptor" url="https://ej2services.syncfusion.com/production/web-services/api/Employees" crossDomain="true"></e-data-manager>

                    <e-combobox-fields text="FirstName" value="EmployeeID"></e-combobox-fields>

        </ejs-combobox>

But if I put my own API as the URL, which has the same formatting as yours, it says "Request failed."





1 Reply

DR Deepak Ramakrishnan Syncfusion Team December 27, 2021 11:10 AM UTC

Hi kevin, 
 
Greetings from Syncfusion support. 
 
Can you please provide simple runnable sample along with your demo api used in your application ? , also kindly provide the replication procedure to replicate the issue in our end . 
 
 
Thanks, 
Deepak R. 
 


Loader.
Up arrow icon