Web Services

By means of the OMC web service API, a contact person’s list of inquiries can be retrieved. Furthermore, you can access each individual inquiry via its ID, optionally specifying the contact person’s ID to restrict access to only this person.

An inquiry consists of the data that was entered initially (such as the contact person concerned) as well as further pieces of information (extensions) added later on, the so-called diary entries. These diary entries can be retrieved as a list.

Also, inquiries may have links attached to them that can be retrieved as a list or individually.

Inquiries as well as extensions and links can also be created using the web service API.

Retrieving, Creating, and Modifying Inquiries

Retrieving the Inquiries of an Account

curl http://hostname/webservice/inquiries \
  -u webservice:apikey \
  -G \
  -d filter[account_id]=1

The OMC returns all the inquiries of the account in an inquiries element that contains an inquiry element for each inquiry:

<?xml version="1.0" encoding="UTF-8"?>
<inquiries type="array">
  <inquiry>
    <agent>smith</agent>
    <closed type="boolean">false</closed>
    <contact_id type="integer">2</contact_id>
    <created_at type="datetime">2009-08-12T10:19:06+02:00</created_at>
    <email_cc nil="true"></email_cc>
    <id type="integer">3</id>
    <kind>support case</kind>
    <owner>root</owner>
    <state>created</state>
    <summary>Where is Flip?</summary>
    <tentative type="boolean">true</tentative>
    <updated_at type="datetime">2009-08-12T10:19:06+02:00</updated_at>
  </inquiry>
  ...
</inquiries>

Retrieving a Contact Person’s List of Inquiries

curl http://hostname/webservice/inquiries \
  -u webservice:apikey \
  -G \
  -d filter[contact_id]=1

The result is an inquiries element in which each inquiry of the contact person concerned is contained in an individual inquiry element.

<?xml version="1.0" encoding="UTF-8"?>
<inquiries type="array">
  <inquiry>
    <agent>smith</agent>
    <closed type="boolean">false</closed>
    <contact_id type="integer">1</contact_id>
    <created_at type="datetime">2008-11-19T14:00:27+01:00</created_at>
    <email_cc nil="true"></email_cc>
    <id type="integer">407</id>
    <kind>support case</kind>
    <owner>root</owner>
    <state>created</state>
    <summary>Anfrage nach Produkt-Informationen</summary>
    <tentative type="boolean">true</tentative>
    <updated_at type="datetime">2008-11-19T14:21:11+01:00</updated_at>
  </inquiry>
  ...
</inquiries>

Retrieving an Inquiry

curl http://hostname/webservice/inquiries/id \
  -u webservice:apikey

The OMC returns the requested inquiry in the inquiry element:

<?xml version="1.0" encoding="UTF-8"?>
<inquiry>
  <agent>smith</agent>
  <closed type="boolean">false</closed>
  <contact_id type="integer">1</contact_id>
  <created_at type="datetime">2008-11-19T14:00:27+01:00</created_at>
  <email_cc nil="true"></email_cc>
  <id type="integer">407</id>
  <kind>support case</kind>
  <owner>root</owner>
  <state>created</state>
  <summary>Anfrage nach Produkt-Informationen</summary>
  <tentative type="boolean">true</tentative>
  <updated_at type="datetime">2008-11-19T14:21:11+01:00</updated_at>
</inquiry>

Creating an Inquiry

An inquiry is always associated with a contact person. The person to which a new inquiry is to be assigned can be specified by means of the inquiry[contact_id] parameter. You can also create a diary by using the Value new_diary:

curl http://hostname/webservice/inquiries \
  -u webservice:apikey \
  -X POST \
  --form-string inquiry[contact_id]=16 \
  --form-string inquiry[summary]="Titel der Anfrage" \
  --form-string inquiry[new_diary][summary]='first diary' \
  --form-string inquiry[new_diary][notes]=newdiarynotes

This returns the inquiry data.

Modifying an Inquiry

Using the following request, an inquiry can be modified (but not extended, see below). Specify the fields to be modified in the request.

curl http://hostname/webservice/inquiries/id \
  -u webservice:apikey \
  -X PUT \
  --form-string inquiry[state]=Done

This returns the inquiry data.

Diary Entries

Retrieving the Diary Entries of an Inquiry

Every inquiry extension is stored as a diary entry of the respective inquiry. Diary entries can neither be subsequently modified nor deleted. The following request determines all public diary entries of a particular inquiry:

curl http://hostname/webservice/diaries \
  -u webservice:apikey \
  -G \
  -d filter[inquiry_id]=5

The diray entries are contained as diary elements in the diaries element:

<?xml version="1.0" encoding="UTF-8"?>
<diaries type="array">
  <diary>
    <account_id type="integer" nil="true"></account_id>
    <contact_id type="integer" nil="true"></contact_id>
    <created_at type="datetime">2009-08-12T10:19:05+02:00</created_at>
    <created_by></created_by>
    <diary_type>call</diary_type>
    <id type="integer">2</id>
    <inquiry_id type="integer">2</inquiry_id>
    <internal>false</internal>
    <notes>The bear has eaten all the honey :(</notes>
    <send_email type="boolean">false</send_email>
    <summary>initial entry's title</summary>
    <updated_at type="datetime">2009-08-12T10:19:05+02:00</updated_at>
    <updated_by></updated_by>
  </diary>
</diaries>

Adding a Diary Entry to an Inquiry

By means of the following request a diary entry can be added to an inquiry.

curl http://hostname/webservice/diaries \
  -u webservice:apikey \
  -X POST \
  --form-string dairy[inquiry_id]=1 \
  --form-string diary[type]=web \
  --form-string diary[internal]=false \
  --form-string diary[title]="Comment" \
  --form-string diary[notes]="Cool site!"

The result is the new diary entry:

<?xml version="1.0" encoding="UTF-8"?>
<diary>
  <account_id type="integer">1</account_id>
  <contact_id type="integer">5</contact_id>
  <created_at type="datetime">2010-07-13T15:25:41+02:00</created_at>
  <created_by>webservice</created_by>
  <diary_type>web</diary_type>
  <id type="integer">12</id>
  <inquiry_id type="integer">1</inquiry_id>
  <internal type="boolean">false</internal>
  <notes>Cool site!</notes>
  <send_email type="boolean">false</send_email>
  <summary>Comment</summary>
  <updated_at type="datetime">2010-07-13T15:25:41+02:00</updated_at>
  <updated_by>webservice</updated_by>
</diary>

To every inquiry any number of links can be attached. You can retrieve, modify, create, and delete links using the following requests.

Retrieving the List of the Links Attached to an Inquiry

curl http://hostname/webservice/inquiries/id/links \
  -u webservice:apikey

The links are contained as link elements in the links element:

<?xml version="1.0" encoding="UTF-8"?>
<links type="array">
  <link>
    <id type="integer">1</id>
    <title>Bear photo</title>
    <url>http://cdkenterprises.com/coloring/Valentines/images/BearHoney.gif</url>
  </link>
  ...
</links>

Retrieving an Individual Link of an Inquiry

curl http://hostname/webservice/inquiries/inquiry_id/links/id \
  -u webservice:apikey

The result is the requested link:

<?xml version="1.0" encoding="UTF-8"?>
<link>
  <id type="integer">1</id>
  <title>Bear photo</title>
  <url>http://cdkenterprises.com/coloring/Valentines/images/BearHoney.gif</url>
</link>

Adding a Link to an Inquiry

curl http://hostname/webservice/inquiries/id/links \
  -u webservice:apikey \
  -X POST \
  --form-string title="Example Ltd." \
  --form-string link[url]=http://www.example.com

The result is the new link.

Modifying a Link of an Inquiry

To modify a link, you need to know its ID. Specify the link fields to be modified in the request.

curl http://hostname/webservice/inquiries/inquiry_id/links/id \
  -u webservice:apikey \
  -X PUT \
  --form-string link[title]="Example Ltd., London"

The result is the modified link.

Deleting a Link of an Inquiry

curl http://hostname/webservice/inquiries/inquiry_id/links/id \
  -u webservice:apikey \
  -X DELETE

The result is a corresponding message:

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <message>Link deleted</message>
</hash>