Batch Requests
For a Batch request ( e.g. to save several objects in one request) there are only 3 parameters expected - username, password & xml. Other parameters are ignored.
xml should contain odata formatted collection on same content type objects.
Below Is Example for Batch Event Creation:
POST "vineyard/rest/v1.1/VY_EVENT/?username=${username}&password=${password}&xml=${}xml"
where xml is
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xml:base="http://localhost:8080/vineyard/rest/v1.1/">
<m:count>2</m:count>
<entry>
<content type="application/xml">
<m:properties>
<d:NAME>Test From Rest 1</d:NAME>
<d:STARTDATE m:type="Edm.DateTime">2012-01-11T00:00:00</d:STARTDATE>
<d:ENDDATE m:type="Edm.DateTime">2012-01-11T00:00:00</d:ENDDATE>
<d:EVENTPHASE m:type="Edm.Decimal">2</d:EVENTPHASE>
<d:EVENTTYPE m:type="Edm.Decimal">-12</d:EVENTTYPE>
<d:DESCRIPTION>Vladimir Test From Rest 1</d:DESCRIPTION>
</m:properties>
</content>
</entry>
<entry>
<content type="application/xml">
<m:properties>
<d:NAME>Test From Rest 2</d:NAME>
<d:STARTDATE m:type="Edm.DateTime">2012-01-11T00:00:00</d:STARTDATE>
<d:ENDDATE m:type="Edm.DateTime">2012-01-11T00:00:00</d:ENDDATE>
<d:EVENTPHASE m:type="Edm.Decimal">2</d:EVENTPHASE>
<d:EVENTTYPE m:type="Edm.Decimal">-12</d:EVENTTYPE>
<d:DESCRIPTION>Test From Rest 2</d:DESCRIPTION>
</m:properties>
</content>
</entry>
</feed>
this will create 2 events in 1 request.
for put operation (batch update) each "m:properties" element should contain property - <d:ID m:type="Edm.Decimal">${id}</d:ID>
As in regular rest, no need to pass all parameters for object update, you can provide only parameters being updated.
Comments
0 comments
Please sign in to leave a comment.