Working with HTML fields

Via the API, you can retrieve and submit text in HTML format for the following Alloy Navigator Express HTML fields.

Object Class Field

Tickets

Description

Knowledge Base Articles

Content

Announcements

Content

Service Catalog Items

Details

NOTE: The format of the Description field varies for different API versions: V1 supports plain text, V2 supports HTML. For more details on API versions, see API Versions

Retrieving the Description field

For example, you retrieve the ticket with the following description in HTML format:


<P>Hello, support!<BR>My computer returned the error message,&nbsp; see the screenshot below:</P>

<P>&nbsp;</P>

<P><IMG border=0 src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABA... ...lUUYwg7etFfIZ3iYYrMsRXgnaUm1ffc9/LqUqOEpU5bpJH/9k="></P>

<P>&nbsp;</P>

<P>What should I do?</P>

<P>&nbsp;</P>

<P><STRONG>John Black</STRONG></P>

When you access the API version 2:

(GET) http://www.example.com/api/v2/object/T000014

You get the value of the Description field with HTML tags:


{

	"name": "Description",

	"caption": "Description",

	"value": "<P>Hello, support!<BR>My computer returned the error 

	message,&nbsp; 	see the screenshot below:</P>

	<P>&nbsp;</P><P><IMG border=0 

	src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABA...

	...lUUYwg7etFfIZ3iYYrMsRXgnaUm1ffc9/LqUqOEpU5bpJH/9k="></P>

	<P>&nbsp;</P><P>What should I do?</P><P>&nbsp;</P>

	<P><STRONG>John Black</STRONG></P>"

}

When you access the API version 1:

(GET) http://www.example.com/api/v1/object/T000014

You get the plain text value:


{

	"name": "Description",

	"caption": "Description",

	"value": "Hello, support!\nMy computer returned the error message, 

	see the screenshot below:\n \n \nWhat should I do?\n \nJohn Black"

}
Submitting the Description field

For example, you create a new ticket and upload the value of the Description field in HTML format:

POST body
{
"ActionId": "801",
"Fields": {
"Summary": "test",
"Description": "<P>Hello, support!<BR>My computer returned the error message.</P>
<P>&nbsp;</P>
<P>What should I do?</P>
<P>&nbsp;</P>
<P><STRONG>Johm Black</STRONG></P>",
"Requester": "PN000022" }
}

When you access the API version 2:

(POST) http://www.example.com/api/v2.

The Description of the created ticket is displayed as normal text:

Hello, support!
My computer returned the error message.

What should I do?

John Black

When you access the API version 1:

(POST) http://www.example.com/api/v1.

The displayed Description is contaminated with HTML tags:

<P>Hello, support!<BR>My computer returned the error message.</P>
<P>&nbsp;</P>
<P>What should I do?</P>
<P>&nbsp;</P>
<P><STRONG>Johm Black</STRONG></P>

NOTE: To avoid problems with displaying the Description text, use the appropriate version of the API:
V1 if the field value is plain text; V2 if the field value is HTML.