- Home
- Forum
- React - EJ 2
- ¿How to make a request to my RESTful API with DataManager and display it in DropDownListComponent?
¿How to make a request to my RESTful API with DataManager and display it in DropDownListComponent?
I am currently working with the Scheduler, and inside my editorTemplate() I have a custom HTML, I want that when I make a GET request to my API with route http://localhost:3001/users I get a response like this:
{
"message": null,
"data": [
{
"idUsuario": "dfeb36ae-7553-4df5-bcaa-ed044bb06d2f",
"numero_documento": ******,
"nombres": "*******",
"apellidos": "*******",
"direccion": "*******",
"foto": "*******",
"correo": "****",
"contacto": [""],
"fecha_nacimiento": "*******",
"estaActivo": ****,
"country": null,
"department": null,
"city": null,
"gender": null,
"role": {
"idRole": "ccc54346-d21e-4898-9718-492987a514b2",
"nombre": "default"
},
"eps": null
}, ... {}, {}, {}
],
"statusCode": 200
}I would like that when obtaining the information from my backend I only obtain the properties of "numero_documento" and "nombres" and show me inside the DropDownListComponent
The problem I have now is that when I query my Frontend with DataManager the response is empty, if I'm doing it incorrectly, could you tell me what would be the correct way to do it?...
Hi Juan,
Sample: https://stackblitz.com/edit/react-dk6pub-1xqg4c?file=index.js,index.css
UG: https://ej2.syncfusion.com/react/documentation/data/adaptors#webmethod-adaptor
Since you are using the WebMethodAdaptor, it expects
a JSON response from the server. The response object should contain properties
named "result" and "count". The "result" property
should contain a collection of entities, and the "count" property
should represent the total count of the entities. However, your current
response does not meet these requirements, making it impossible to obtain
values on the front end. We request you to modify your back-end code to provide
a response as described below. Refer to the shared UG for more details.
[Expected Response]
|
{ result: [{..}, {..}, {..}, ...], count: 830 } |
Regards,
Venkatesh
I am working with NextJS13, I did the steps as you told me, but I get this error...
- 3 Replies
- 4 Participants
-
JS Juan Sebastian Artunduaga Rojas
- Jul 10, 2023 09:36 PM UTC
- Jul 19, 2023 12:35 PM UTC