Put Updated Resource
Once the client has a private lock URI, it can PUT
an update request. The request must contain the following headers:
-
Content-Type
, set toapplication/atom+xml;type=entry
-
X-Escenic-Locks
, containing the private lock URI. If you want to request several fragment locks at once, you can do so by repeating this header. -
If-Match
, set to the appropriateE-Tag
value. See Optimistic Concurrency for more information aboutE-Tag
and the use of theIf-Match
header.
Here is an example update request:
curl --include -u user:password -X PUT \ -H "Content-Type: application/atom+xml;type=entry" \ -H "X-Escenic-Locks: http://host-ip-address/webservice/escenic/lock/article/4/private/9" \ -H 'If-Match: "129694559e911ee4c6d04212982"' \ http://host-ip-address/webservice/escenic/content/4 --upload-file atom-entry-file
where atom-entry-file is the path of a file containing the updated resource:
<?xml version="1.0"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:metadata="http://xmlns.escenic.com/2010/atom-metadata" xmlns:dcterms="http://purl.org/dc/terms/"> <id>http://host-ip-address/webservice/escenic/content/4</id> <title type="text">My Updated Title</title> <updated>2010-12-01T10:13:00.000Z</updated> <app:edited>2010-12-03T10:13:06.000Z</app:edited> <published>2010-12-01T10:13:00.000Z</published> <dcterms:created>2010-12-01T10:13:00.000Z</dcterms:created> <author> <name>Marcus Tullius Cicero</name> <uri>http://host-ip-address/webservice/escenic/person/2</uri> </author> <dcterms:identifier>4</dcterms:identifier> <metadata:reference source="ece-auto-gen" sourceid="0b8a67bc-7b2d-493b-b6b5-d659f1beff81"/> <link rel="http://www.vizrt.com/types/relation/home-section" href="http://host-ip-address/webservice/escenic/section/3" title="Examples" type="application/atom+xml; type=entry"/> <link href="http://host-ip-address/pub1/Examples/article4.ece" rel="alternate"/> <link rel="http://www.vizrt.com/types/relation/publication" href="http://host-ip-address/webservice/escenic/publication/pub1" title="pub1" type="application/atom+xml; type=entry"/> <metadata:creator/> <metadata:publication href="http://host-ip-address/webservice/escenic/publication/pub1"> <link rel="http://www.vizrt.com/types/relation/home-section" href="http://host-ip-address/webservice/escenic/section/3" title="Examples" type="application/atom+xml; type=entry"/> <link rel="http://www.vizrt.com/types/relation/section" href="http://host-ip-address/webservice/escenic/section/3" title="Examples" type="application/atom+xml; type=entry"/> </metadata:publication> <link href="http://host-ip-address/webservice/escenic/content/4" rel="edit"/> <link href="http://host-ip-address/webservice/escenic/content/4" rel="self"/> <link href="http://host-ip-address/webservice/escenic/lock/article/4" rel="http://www.vizrt.com/types/relation/lock"/> <content type="application/vnd.vizrt.payload+xml"> <vdf:payload xmlns:vdf="http://www.vizrt.com/types" model="http://host-ip-address/webservice/escenic/model/news"> <vdf:field name="TITLE"><vdf:value>My Updated Title</vdf:value></vdf:field> <vdf:field name="SUMMARY"> <vdf:value>More text for Latin lovers</vdf:value> </vdf:field> <vdf:field name="BODY"> <vdf:value> <div xmlns="http://www.w3.org/1999/xhtml"> <p>Simple Body</p> </div> </vdf:value> </vdf:field> </vdf:payload> </content> </entry>
If the PUT
request succeeds, then the web service
returns a 200 OK
response:
HTTP/1.1 100 Continue HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: application/atom+xml;type=entry Content-Length: 0 Date: Sat, 04 Dec 2010 02:53:02 GMT
In most cases the fragment identifier used in lock requests
corresponds directly to the name of a content item field. The
fragment identifier TITLE
used in the above
example, however, is a special case. It corresponds to whatever
content item field has been designated as the title in the
publication's content-type
resource. This field
is never returned in an entry resource's VDF payload: its content is
instead returned as the entry's title
element. In
order to update this field, therefore, the client must actually
update the entry resource's title
element as
shown in the above example.
For information about how a field is designated as content item's title, see title-field.