Http GetByID returning undefined object

Hi, I am a new developer so there is most probably a fault on my side.

All my other requests work perfectly, i.e. get (all), post, put and delete.

Hoverwer whenever I request http get(id) an undefined object is returned.

Please let me know what you need to figure out what's happening.

Can you post the response of this request from browser network tab?

${result} when calling get(id) request with radzen

45

Result when calling get(id) via postman:

{
"id": 1,
"code": "string",
"title": "string",
"initials": "string",
"firstName": "string",
"lastName": "string",
"gender": "string",
"birthDate": "2019-11-06T00:00:00",
"maritalStatus": "string",
"idType": "string",
"idNumber": "string",
"isDeleted": true,
"clientIds": [],
"clientRelatedIds": [],
"leadIds": [],
"addressIds": [],
"bankAccountIds": [],
"contactIds": [],
"occupationIds": []
}

Hope this helps

I think u missunderstood,

this is what was in the network tab when making the request with radzen

49

According to the result an object is properly returned. What is undefined?

45

this is what I get when I log $(result) after doing the request

This is different from the previous screenshot from your browser console. Where you log the result? Can you post a screenshot?

Is this what you need?

Can you post also what parameters are passed for this Invoke?

I have just used 1 for now to test, as I definitely know there is a person with id 1 in my database. I will be using page parameters in my actual application.

Everything looks correct. In this post the response is correct: Http GetByID returning undefined object. How you've executed the request? Is it from the same invoke?

I looked around in the generated files and found the problem in the generated .services file.

Is there something I could've done incorrectly on my side to cause the services being generated like this?

Here is the Swagger generated by Radzen for getBy when accessing SQL database:

What’s the difference compared to your Swagger?

"/api/persons/{id}": {
  "get": {
    "tags": [
      "Persons"
    ],
    "operationId": "GetPersonAsync",
    "consumes": [],
    "produces": [],
    "parameters": [
      {
        "name": "id",
        "in": "path",
        "required": true,
        "type": "integer",
        "format": "int32"
      }
    ],
    "responses": {
      "200": {
        "description": "Success"
      }
    }
  },

Here is the code in my Data.json file. I have no idea what to look for.

Your Swagger is not valid as the response does not specify any schema - only description.

Thanks, I will try and see how I can fix it on my side. Thank you for helping, sorry for any inconvenience.

I should correct my answer a bit. Your swagger is valid however it does not correctly represent your REST API which returns a response.