Create a Person

The procedure for creating a new person is more or less identical to creating a new content item. Your client application must create an Atom entry resource containing a VDF payload document:

<?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/">
  <content type="application/vnd.vizrt.payload+xml">
    <vdf:payload xmlns:vdf="http://www.vizrt.com/types" model="http://host-ip-address/webservice/escenic/publication/test/model/com.escenic.person">
      <vdf:field name="com.escenic.username"/>
      <vdf:field name="com.escenic.firstName">
        <vdf:value>Fred</vdf:value>
      </vdf:field>
      <vdf:field name="com.escenic.surName">
        <vdf:value>Flintstone</vdf:value>
      </vdf:field>
      <vdf:field name="com.escenic.occupation"/>
      <vdf:field name="com.escenic.address"/>
      <vdf:field name="com.escenic.postalcode"/>
      <vdf:field name="com.escenic.city"/>
      <vdf:field name="com.escenic.phonework"/>
      <vdf:field name="com.escenic.phonemobile"/>
      <vdf:field name="com.escenic.phoneprivate"/>
      <vdf:field name="com.escenic.emailaddress"/>
    </vdf:payload>
  </content>
  <title type="text">Flintstone</title>
  <summary type="text">Fred Flintstone</summary>
  <metadata:publication href="http://host-ip-address/webservice/escenic/publication/test/" title="test"/>
</entry>

Your payload document must include a com.escenic.surname field, and the field must contain a value, otherwise no person record can be created.

This document must then be saved in a file (my-new-person.xml, for example) and POSTed to the URI of the person collection. This URI is supplied as a link in the web service's "start" feed resource and has the link type http://www.vizrt.com/types/relation/person (see http://www.vizrt.com/types/relation/person).

curl --include -u user:password -X POST -H "Content-Type: application/atom+xml" \
> http://host-ip-address/webservice/escenic/person --upload-file my-new-person.xml
HTTP/1.1 100 Continue

HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location: http://localhost:8080/webservice/escenic/person/35
Content-Type: application/atom+xml; type=entry
Content-Length: 0
Date: Tue, 20 Mar 2012 06:59:38 GMT

In order for the POST operation to work, you must specify a HTTP header as shown above.

If you're using curl, it's a good idea to specify --include with POST operations: curl will then output the response header returned from the web service as shown above, and you can verify whether or not the operation was successful:

  • A response code in the 2xx range indicates success.

  • A response code in the 4xx range means that you made an invalid addition and the server won't accept your new content item.

  • A response code in the 5xx range means there is a server error.

The Location response specifies the location of the newly-created person record: you can retrieve the person record by submitting a GET request to this URL.

A quick way of finding out how to create a correctly structured person in VDF format is to GET a person and copy the structure.