Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to build request body for Deep Insert with navigation properties. Facing issue.

0 Kudos

Hi, I am building a JSON request body using postman. I want to insert multiple entities or in other words Deep Insert.

I am using this https://services.odata.org/V4/TripPinService/$metadata for building requests.

This is my request for EntitySet People, which includes navigation property i.e Friends

POST: https://services.odata.org/TripPinRESTierService/(S(xt3fdfsg1vd1qxc2ot1dppka))/People

Request Body:

{
  "UserName": "vinaysharmatest",
  "FirstName": "Vinay",
  "LastName": "Sharma",
  "Emails": [
    "vinay.sharma1@example.com"
  ],
  "AddressInfo": [
    {
      "Address": "187 Suffolk Ln.",
      "City": {
        "Name": "Boise",
        "CountryRegion": "United States",
        "Region": "ID"
      }
    }
  ],
  "Friends": [
    {
      "UserName": "vincentcalabrese",
      "FirstName": "Vincent",
      "LastName": "Calabrese",
      "Emails": [
        "Vincent@example.com",
        "Vincent@contoso.com"
      ],
      "AddressInfo": [
        {
          "Address": "55 Grizzly Peak Rd.",
          "City": {
            "CountryRegion": "United States",
            "Name": "Butte",
            "Region": "MT"
          }
        }
      ],
      "Gender": "Male",
      "Concurrency": 637556417625349000
    }
  ]
}

and i am getting this

(500 Internal Server Error)

{
    "error": {
        "code": "",
        "message": "Value cannot be null.\r\nParameter name: edmEntityObject"
    }
}
3 REPLIES 3

former_member34
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with our Q&A Tutorial: https://developers.sap.com/tutorials/community-qa.html, as it provides tips for preparing questions that draw responses from our members. Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM

Many thanks!

CarlosRoggan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

I've tried the same and also tried deep insert with trips, and getting the same error.
The error is generic and seems to be thrown by the underlying OData library.
I assume that the service implementation does not cover the deep insert.

Your payload looks good to me

If you want to play with other odata services, you may check the GWSAMPLE_BASIC, which should be still available for public testing on demo server ES5

Kind Regards,

Carlos

0 Kudos

Thank you for the response.