Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3678688
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:22:17+00:00 2026-05-19T03:22:17+00:00

In the OData:Operations documentation, section 2.4 fourth paragraph down, it reads when creating an

  • 0

In the OData:Operations documentation, section 2.4 fourth paragraph down, it reads when creating an entity with POST it is also possible to create a link within the same request. However, I’m having trouble trying to make this work. A similar question has been asked about many-to-many linking while creating and it looks like that particular scenario isn’t possible without a batch request. Below is the scenario I’m trying to create using this sample OData read write service.

Create a new Product named “Test Product” and link it to Category(0) in a single POST using JSON.

I have tried…


POST /OData/OData.svc/Products HTTP/1.1
Accept: application/json
Content-Type: application/json

{ "ID": 99, "Name": "Test Product", "Description": "Simple Test", "ReleaseDate": "\/Date(1210204800000)\/", "DiscontinuedDate": null, "Rating": 3, "Price": "99.99", "Category":"http://services.odata.org/OData/OData.svc/Categories(0)" }

and …


POST /OData/OData.svc/Products HTTP/1.1
Accept: application/json
Content-Type: application/json

{ "ID": 99, "Name": "Test Product", "Description": "Simple Test", "ReleaseDate": "\/Date(1210204800000)\/", "DiscontinuedDate": null, "Rating": 3, "Price": "99.99", "Category": {"uri": "http://services.odata.org/OData/OData.svc/Categories(0)"} }

Both which result in failures.

Another example using atom format…

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
    <title type="text"/>
    <updated>2010-02-27T21:36:47Z</updated>
    <author>
        <name/>
    </author>
    <Link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=Entry" title="Category" href="Categories(0)"/>
    <category term="ODataDemo.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
    <content type="application/xml">
        <m:properties>
            <d:ID m:type="Edm.Int32">99</d:ID>
            <d:Name m:type="Edm.String">New Product</d:Name>
            <d:ReleaseDate m:type="Edm.DateTime">1992-01-01T00:00:00</d:ReleaseDate>
            <d:DiscontinuedDate m:type="Edm.DateTime" m:null="true"/>
            <d:Rating m:type="Edm.Int32">4</d:Rating>
            <d:Price m:type="Edm.Decimal">2.5</d:Price>
        </m:properties>
    </content>
</entry>

The above results in a 201 created, yet no association is created for the new Product linking to the existing Category.

Any help would be appreciated. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:22:18+00:00Added an answer on May 19, 2026 at 3:22 am

    Pablo Castro from Microsoft answered my question. He suggested in the Atom payload I change the capital “L”, to lowercase. IE.

    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=entry" title="Category" href="Categories(0)"/>
    

    For the JSON payload you need to include “__metadata” in order for it to work. IE.

    {
     Prop1: ...,
     Prop2: ...,
     LinkProp1: { __metadata: { uri: "http://..." } }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.