Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-510

Problem when using the ODataReferenceAddingRequest to add a reference to a property

    XMLWordPrintableJSON

    Details

      Description

      When using a ODataReferenceAddingRequest to a reference for a property:

      String serviceRoot = (...);
      URI productCategoriesUri = client.newURIBuilder(serviceRoot)
      .appendEntitySetSegment("Products")
      .appendKeySegment(1)
      .appendNavigationSegment("Categories")
      .appendRefSegment()
      .build();

      URI ref = client.newURIBuilder(serviceRoot)
      .appendEntitySetSegment("Categories")
      .appendKeySegment(1)
      .build();

      ODataReferenceAddingRequest req = client.getCUDRequestFactory()
      .getReferenceAddingRequest(productCategoriesUri, ref);
      ODataReferenceAddingResponse res = req.execute();

      The link of the reference to add isn't sent in the payload of the request.

      Here is the simplified content of the request:

      POST /V4/OData/(S(li4s4wcplcgyiy3uvuog1lxl))/OData.svc/Products(1)/Supplier/$ref

      and the simplified content of the response:

      HTTP/1.1 400 Bad Request
      {
      "error":{
      "code":"",
      "message":"An error occurred while processing this request.",
      "innererror":

      { "message":"An unexpected 'EndOfInput' node was found when reading from the JSON reader. A 'StartObject' node was expected.","type":"Microsoft.OData.Core.ODataException","stacktrace":" " }

      }
      }

      We should have something like this in the payload:

      {
      "@odata.id":"http://(...)/Suppliers(4)"
      }

        Attachments

          Activity

            People

            • Assignee:
              chrisam Christian Amend
              Reporter:
              templth Thierry Templier
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: