Creating REST URIs to submit records
You can create REST URIs to submit records in your user database.
About this task
Procedure
- On the HCL Compass Web
toolbar, click the arrow next to New Change Request and
select New REST URI. The New REST URI template window opens.
- Select Submit a record from the REST URI Type list.
- Select a record type from the Record Type list.
- Optional: Select the record fields to add as parameters to the REST URI from the Record fields to fill automatically list.
- Optional: To save all changes to the record, select the Automatically save changes check box.
- Optional: To add HCL Compass Web logon parameters to your REST URI, select the Automatically log in check box.
- Optional: To include the banner, workspace tree, and main toolbar in the window that opens when the REST URI runs, select the Include the banner, workspace tree, and main toolbar check box.
- Click Create.The REST URI template appears in the REST URI Template field.
- Copy the template into a text editor and replace the placeholders,
which are enclosed by double curly brackets {{ }}, with appropriate
values.
Optional: Change the default format for the resource request from
HTML
toXML
orATOM
. - Copy the modified template into your web application or another Web browser window.
- Click Reset to create a new REST URI template or Close to exit.
Example
Examples
The following REST URI template
to submit a record was created by using the New REST URI wizard. In
this example, ALMActivity
was selected from the Record
Type list and the check boxes Automatically
save changes, Automatically log in,
and Include the banner, workspace tree, and main toolbar were
selected to create the REST URI.
http://CQWebServerHost/cqweb/restapi/YourConnection/YourUserDB/RECORD?format=HTML&recordType=ALMActivity&fieldsXml=&autoSave=true&loginId={{loginid}}&password={{password}}
- CQWebServerHost
- Web address of your HCL Compass Web server host system. This value is defined when the REST URI template is created.
- YourConnection
- Your HCL Compass connection. This value is defined when the REST URI template is created.
- YourUserDB
- Your HCL Compass user database. This value is defined when the REST URI template is created.
- format
- The default format for the resource request is
HTML
. You can change the format toXML
orATOM
, if desired. - {{loginid}}
- Replace with your logon ID.
- {{password}}
- Replace with your password.
The following examples show how to enter date field, reference field, reference list, and multiple-line field values as parameters in a REST URI.
- This example shows how to supply a date field value as a parameter
in a REST URI to submit or modify a record:
fieldsXML=<Field><Name>f_datetime</Name><Value><![CDATA[2008-09-08%2009%3A44%3A34]]></Value></Field>
Result: The record field f_datetime is set to
08/09/08 09:44:34
. - The next example shows how to supply a reference field or reference
list values as parameters in a REST URI to submit or modify a record:
fieldsXML=<Field><Name>customer</Name><Value><!CDATA[Joe%20Lee]]></Value><Value><!CDATA[Jane%20Smith]]></Value></Field><Field><Name>Project</Name><Value><!CDATA[Classics]]></Value></Field>
Result: In the reference list customer in the record,
Joe Lee
andJane Smith
are added, and in the reference field Project,Classics
is added. - This example shows how to supply a multiple-line field value as
a parameter in a REST URI to submit or modify a record:
fieldsXML=<Field><Name>Description</Name><Value><![CDATA[firstline%0Asecondline]]></Value></Field>
Result: In the record field Description, the text
firstline
andsecondline
are formatted to appear on separate lines.