Request Operations

     

    The operations on request such as adding new request, updating, closing, deleting and viewing the existing request are discussed under this section.

    To perform operations on the request, the following URL patterns should be used.

     

    For adding request:

    http://<servername>:<port number>/sdpapi/request/

     

    For operations on a specific request:

    http://<servername>:<port number>/sdpapi/request/<request id>

     


    Contents


     

    Adding Request

    Say, you are running ServiceDesk Plus - MSP with the server name "localhost" in the port "8080". You are creating a new request for the requester Shawn Adams, who is unable to browse the internet. The input and output XML formats for the above scenario are given below,

    To add a new request, the URL is given as: 

    http://<servername>:<port number>/sdpapi/request/

     

    So for the scenario above, the URL is:

    http://localhost:8080/sdpapi/request/

     

    Key Points:

    1. The operation name "ADD_REQUEST"  should be sent as a "POST attribute" with key "OPERATION_NAME".

    2. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

    3. Input is an XML string sent as a "POST attribute" with key "INPUT_DATA".

    Note: Please note that the Input and Output XML formats have been changed. But for compatibility reasons, the Input operation will support both the formats.

     

    Input - Format 1:

     

    <Operation>

    <Details>

    <parameter>

    <name>requester</name>

    <value>Shawn Adams</value>

    </parameter>

    <parameter>

    <name>subject</name>

    <value>The subject of the request</value>

    </parameter>

    <parameter>

    <name>description</name>

    <value>The description of the request</value>

    </parameter>

    <parameter>

    <name>callbackURL</name>

    <value>http://localhost:8080/CustomReportHandler.do</value>

    </parameter>

    <parameter>

    <name>requesttemplate</name>

    <value>Unable to browse</value>

    </parameter>

    <parameter>

    <name>priority</name>

    <value>High</value>

    </parameter>

    <parameter>

    <name>site</name>

    <value>New York</value>

    </parameter>

    <parameter>

    <name>group</name>

    <value>Network</value>

    </parameter>

    <parameter>

    <name>technician</name>

    <value>Howard Stern</value>

    </parameter>

    <parameter>

    <name>level</name>

    <value>Tier 3</value>

    </parameter>

    <parameter>

    <name>status</name>

    <value>Open</value>

    </parameter>

    <parameter>

    <name>service</name>

    <value>Email</value>

    </parameter>

    </Details>

    </Operation>

     

     

    Input - Format 2:

     

    <Operation>

    <Details>

    <requester>Shawn Adams</requester>

    <subject>Specify Subject</subject>

    <description>Specify Description</description>

    <callbackURL>http://localhost:8080/CustomReportHandler.do</callbackURL>

    <requesttemplate>Unable to browse</requesttemplate>

    <priority>High</priority>

    <site>New York</site>

    <group>Network</group>

    <technician>Howard Stern</technician>

    <level>Tier 3</level>

    <status>open</status>

    <service>Email</service>

    </Details>

    </Operation>

     

     

    Output:

    The Output format for the operation "Add Request" supports both the formats.

     

    <?xml version="1.0" encoding="UTF-8"?>

    <operation name="ADD_REQUEST">

    <result>

    <status>Success</status>

    <message>Request added successfully</message>

    </result>

    <Details>

    <workorderid>25</workorderid>

    </Details>

    <Details>

    <parameter>

    <name>workorderid</name>

    <value>25</value>

    </parameter>

    </Details>

    </operation>

     

     

    Editing Request

    To edit a request, the URL is given as: 

    http://<servername>:<port number>/sdpapi/request/<request id>

     

    Assume the Request ID to edit is 25, then the URL is: http://localhost:8080/sdpapi/request/25

     

    Key Points:

    1. The operation name "EDIT_REQUEST"  should be sent as a "POST attribute" with key "OPERATION_NAME"

    2. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY"

    3. Input is an XML string sent as "POST attribute" with key "INPUT_DATA".

    Note: Please note that the Input and Output XML formats have been changed. But for compatibility reasons, the Input operation will support both the formats.

     

    Input - Format 1:

     

    <Operation>

    <Details>

    <parameter>

    <name>level</name>

    <value>Tier 3</value>

    </parameter>

    </Details>

    </Operation>

     

    Input - Format 2:

     

    <Operation>

    <Details>

    <level>Tier 3</level>

    </Details>

    </Operation>

     

     

    Output:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <operation name="EDIT_REQUEST">

    <result>

    <status>Success</status>

    <message>Request 25 successfully edited</message>

    </result>

    </operation>

     

     

    Viewing Request

    To view a request, the URL is given as: 

    http://<servername>:<port number>/sdpapi/request/<request id>

     

    Assume the Request ID to view is 24, then the URL is: http://localhost:8080/sdpapi/request/24/

     

    Key points:

    1. The operation name "GET_REQUEST" should be sent as a "POST attribute" with key "OPERATION_NAME".

    2. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

    3. Input is not required for viewing requests.

    Note: Please note that the Input and Output XML formats have been changed. But for compatibility reasons, the Input operation will support both the formats.

     

    Output:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <operation name="GET_REQUEST">

    <result>

    <status>Success</status>

    <message>Request details fetched successfully</message>

    </result>

    <Details>

    <parameter>

    <name>workorderid</name>

    <value>24</value>

    </parameter>

    <parameter>

    <name>requester</name>

    <value>Howard Stern</value>

    </parameter>

    <parameter>

    <name>createdby</name>

    <value>Howard Stern</value>

    </parameter>

    <parameter>

    <name>createdtime</name>

    <value>31 May 2011, 20:52:26</value>

    </parameter>

    <parameter>

    <name>duebytime</name>

    <value>01 Jun 2011, 10:00:00</value>

    </parameter>

    <parameter>

    <name>timespentonreq</name>

    <value>0hrs 0min</value>

    </parameter>

    <parameter>

    <name>subject</name>

    <value>The subject of the request</value>

    </parameter>

    <parameter>

    <name>requesttemplate</name>

    <value>Unable to browse</value>

    </parameter>

    <parameter>

    <name>sla</name>

    <value>High SLA</value>

    </parameter>

    <parameter>

    <name>service</name>

    <value>Email</value>

    </parameter>

    <parameter>

    <name>technician</name>

    <value>Howard Stern</value>

    </parameter>

    <parameter>

    <name>status</name>

    <value>Open</value>

    </parameter>

    <parameter>

    <name>priority</name>

    <value>High</value>

    </parameter>

    <parameter>

    <name>level</name>

    <value>Tier 3</value>

    </parameter>

    <parameter>

    <name>group</name>

    <value>Network</value>

    </parameter>

    <parameter>

    <name>description</name>

    <value>The description of the request</value>

    </parameter>

    <Notes URI="http://localhost:8080/sdpapi/request/24/notes/"/>

    <Worklogs URI="http://localhost:8080/sdpapi/request/24/worklogs/"/>

    </Details>

    </Operation>

     

     

    Deleting Request

    To delete a request, the URL is given as: 

    http://<servername>:<port number>/sdpapi/request/<request id>

     

    Assume the Request ID to delete is 21, then the URL is: http://localhost:8080/sdpapi/request/21/

     

    Key points:

    1. The operation name "DELETE_REQUEST" should be sent as a "POST attribute" with key "OPERATION_NAME".

    2. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

    3. Input is not required for deleting requests.

    Note: Please note that the Input and Output XML formats have been changed. But for compatibility reasons, the Input operation will support both the formats.

     

    Output:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <operation name="DELETE_REQUEST">

    <result>

    <status>Success</status>

    <message>Request deleted successfully</message>

    </result>

    </operation>

     

     

    Close Request

    To close a request, the URL is given as: 

    http://<servername>:<port number>/sdpapi/request/<request id>

     

    Assume the Request ID to close is 25, then the URL is given as: http://localhost:8080/sdpapi/request/25

     

    Key points:

    1. The operation name "CLOSE_REQUEST" should be sent as a "POST attribute" with key "OPERATION_NAME".

    2. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

    3. The input XML is optional. If specified, then the input is an XML string sent as "POST attribute" with key "INPUT_DATA".

    Note: Please note that the Input and Output XML formats have been changed. But for compatibility reasons, the Input operation will support both the formats.

     

    Input - Format 1:

     

    <Operation>

    <Details>

    <parameter>

    <name>closeAccepted</name>

    <value>Accepted</value>

    </parameter>

    <parameter>

    <name>closeComment</name>

    <value>The Closing Comment</value>

    </parameter>

    </Details>

    </Operation>

     

    Input - Format 2:

     

    <Operation>

    <Details>

    <closeAccepted>Accepted</closeAccepted>

    <closeComment>this is close comment</closeComment>

    </Details>

    </Operation>

     

    Output:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <operation name="CLOSE_REQUEST">

    <result>

    <status>Success</status>

    <message>Request closed successfully</message>

    </result>

    </operation>

     

     

     Add Attachment

    To append attachments to requests, the URL is given as: 

    http://<servername>:<port number>/sdpapi/request/<request id>/attachment

     

    Assume the Request ID is 25,then the URL is given as: http://localhost:8080/sdpapi/request/25/attachment

     

    Key points:

    1. The operation name "ADD_ATTACHMENT " should be sent as a "POST attribute" with key "OPERATION_NAME".

    2. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

     

    Note: Please note that the Output XML format has been changed. But for compatibility reasons, the Input operation will support both the formats.

     

    Attachment Client Side Snippet:


    The snippet provided below is an example of how you can append "Attachments to Requests" written in java.


    {

    /**

    * 1. Create a MultipartPostMethod

    * 2. Construct the web URL to connect to the SDP Server

    * 3. Add the filename to be attached as a parameter to the MultipartPostMethod with parameter name "filename"

    * 4. Execute the MultipartPostMethod

    * 5. Receive and process the response as required

    * /

    HttpClient client = new HttpClient( );

    String weblinkURL = "http://<SDPServer>:<PortNumber>/sdpapi/request/<requestId>/attachment?OPERATION_NAME=ADD_ATTACHMENT&TECHNICIAN_KEY=<general technician API key>";

    MultipartPostMethod method = new MultipartPostMethod( weblinkURL );

    String fileName = "C:" + File.pathSeparator + "ManageEngine" + File.pathSeparator + "ServiceDesk" + File.pathSeparator + "a.csv";

    File file = new File(fileName);

    method.addParameter("filename", file );


    try {

    client.executeMethod( method );

    String response = method.getResponseBodyAsString();

    System.out.println( response );

    } catch  (HttpException he) {

    System.out.println( he );

    } catch (Exception e) {

    System.out.println( e );

    } finally {

    method.releaseConnection( );

     

    }

    }



    Note: Please note that the Input and Output XML formats have been changed. But for compatibility reasons, the Input operation will support both the formats.

     

    Output:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <operation name="ADD_ATTACHMENT">

    <result>

    <statuscode>200</statuscode>

    <status>Success</status>

    <message>Attachments added successfully</message>

    </result>

    <Details type="attachment"/>

    </operation>

     

     

    Copyright © 2017, ZOHO Corp. All Rights Reserved.