Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odata TripPin sample can not create entity with Gender enum #361

Open
dmytro-sylaiev opened this issue Sep 21, 2023 · 0 comments
Open

Odata TripPin sample can not create entity with Gender enum #361

dmytro-sylaiev opened this issue Sep 21, 2023 · 0 comments

Comments

@dmytro-sylaiev
Copy link

I'm trying to insert an Entity to the odata sample TripPinRESTierService. Got a special key that allows me to make a modification, send a request

POST https://services.odata.org/TripPinRESTierService/(S(<key>))/People

headers:
Content-Type:application/json

body:
{
"UserName": "teresa",
"FirstName" : "Teresa",
"LastName" : "Gilbert"
}

And have a response 201 Created

But when I add a Gender (enum) value to the body:

POST https://services.odata.org/TripPinRESTierService/(S(<key>))/People

headers:
Content-Type:application/json

body:
{
"UserName": "teresa",
"FirstName" : "Teresa",
"LastName" : "Gilbert",
"Gender" : "Female"
}

I have a 500 Internal Server Error:

{
    "error": {
        "code": "",
        "message": "Gender"
    }
}

The property description in the odata $metadata:

<Property Name="Gender" Type="Trippin.PersonGender" Nullable="false"/>
...
<EnumType Name="PersonGender">
    <Member Name="Male" Value="0" />
    <Member Name="Female" Value="1" />
    <Member Name="Unknown" Value="2" />
</EnumType>

I also tried with setting just int values to the body, or Trippin.PersonGender'Male' but have the same result. The example for the odata.org says I just need to set a simple string value: https://www.odata.org/getting-started/basic-tutorial/#create

It works well when I'm doing same operation for (http://services.odata.org/V4/(S())/TripPinServiceRW)
What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant