cancel
Showing results for 
Search instead for 
Did you mean: 

Format of URL & HTTP body for generic OData channel request

Former Member
0 Kudos

Hi,

I'm trying to test an update method of a custom odata channel service.

I need to pass in two collections/entities to the update - one effectively a structure, the other a table of values.

I'm struggling to find an example of the URL & message body format for passing in multiple collections.

Any guidance would be appreciated.

Thanks

Tim

Edited by: Tim Brown on Dec 2, 2011 11:47 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

AshwinDutt
Active Contributor
0 Kudos

Hello,

Please have look at the below Doc which describes all the necessary steps for accomplishing your scenario.

Regards,

Ashwin

Former Member
0 Kudos
Former Member
0 Kudos

Hi Tim,

You can update only one collection at a time.

However if there are two entities related with Navigation Property, you could perform a deep insert, an HTTP POST on the resource URL

For Example if you have a Flight Entity Related to Bookings entity then, you could create a Flight Detail with all its related Booking Details as iniline

Example

<atom:entry xml:base="/sap/opu/sdata/IWBEP/SG_LOCAL_SAMPLE_SFL/"

xmlns:atom="http://www.w3.org/2005/Atom"

xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"

xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

xmlns:sap="http://www.sap.com/Protocols/SAPData">

<atom:content type="application/xml">

<m:properties>

<d:airlineid>LH</d:airlineid>

<d:planetype>A319</d:planetype>

<d:price m:Type="Edm.Decimal">996.00</d:price>

<d:flightdate m:Type="Edm.DateTime">2011-08-04T00:00:00</d:flightdate>

<d:connectid>0400</d:connectid>

<d:curr>DEM</d:curr>

</m:properties>

</atom:content>

<atom:link href="flightCollection/bookings" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/bookings"

type="application/atom+xml;type=feed" title="sflight.bookings">

<m:inline>

<atom:feed

xmlns:atom="http://www.w3.org/2005/Atom"

xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"

xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

xmlns:sap="http://www.sap.com/Protocols/SAPData">

<atom:entry>

<atom:author/>

<atom:content type="application/xml">

<m:properties>

<d:airlineid>LH</d:airlineid>

<d:connectid>0400</d:connectid>

<d:customerid>00000003</d:customerid>

<d:agencynum>55</d:agencynum>

<d:class>Y</d:class>

<d:flightdate m:Type="Edm.DateTime">2011-08-04T00:00:00</d:flightdate>

</m:properties>

</atom:content>

</atom:entry>

</atom:feed>

</m:inline>

</atom:link>

</atom:entry>

Regards

Chandan

Former Member
0 Kudos

Chandan,

Thanks for the info.

Could you please provide a bit more detail on this. In particular:

Can you explain the components of the following tag: "<atom:link href="flightCollection/bookings" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/bookings" type="application/atom+xml;type=feed" title="sflight.bookings">"

What if you need to pass in multiple records in the associated (eg booking) entity?

Thanks

Tim

Former Member
0 Kudos

Hi Tim,

the atom:link in this example indicates that a bookingCollection is inserted along with FlightCollection. The data for booking entity is provided as inline to Flight entity.

As you can see there an atom:feed for bookingCollection provided inline within the atom:link tag. If you would like to insert multiple records the input request would look like

"<atom:link href="flightCollection/bookings" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/bookings" type="application/atom+xml;type=feed" title="sflight.bookings">

<atom:feed>

<atom:entry>

<m:properties>

<d:field1></d:field1>

</m:properties>

<atom:entry>

<atom:entry>

<m:properties>

<d:field1></d:field1>

</m:properties>

<atom:entry>

</atom:feed>

</atom:link>"

More details @ - http://help.sap.com/saphelp_gateway20sp02/helpdata/en/63/b45e1756d94c748affe4282fd3ff55/content.htm

You could also refer to Odata Spec @ http://www.odata.org/media/6655/[mc-apdsu][1].htm#z1298c5115e2f45a9bdf577748f7b7fc2

Regards

Chandan