Skip to content

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

@dmytro-sylaiev

Description

@dmytro-sylaiev

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions