This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

How can I use the API to get service request variables?

I'm brand new to SWWD and not that great with working with APIs but, I've managed to GET an incident by Incident Number using PowerShell.  The incident was created by a process in Service Catalog and returns a bunch of variables.  What I can't find is how to GET the service_request_variables that are part of the incident using the API.  Any help or direction would be appreciated.

  • Try tacking on ?layout=long to the end of your request URL. The API assumes you want truncated responses (which includes all kinds of junk like the reports-to of the person to whom the ticket is assigned, etc), but you're looking for request_variables that are not included in the short response.

    When I use a normal request URL, like [API URL]/incidents/[incidentnumber].xml I get a response of about 200 lines.

    When I use [API URL]/incidents/[incidentnumber].xml?layout=long I get a response of about 900 lines, and near the bottom of the response I see:

    <request_variables>
    <request_variable>
    <id>71254338</id>
    <uuid>v83b49e</uuid>
    <name>SW ID</name>
    <type>free_text</type>
    <options></options>
    <required nil="true"/>
    <value>{value}</value>
    <raw_value>{value}</raw_value>
    </request_variable>
    <request_variable>
    <id>71254339</id>
    <uuid>v85655a</uuid>
    <name>Hardware_Tag</name>
    <type>free_text</type>
    <options></options>
    <required>true</required>
    <value>012345</value>
    <raw_value>012345</raw_value>
    </request_variable>
    </request_variables>
    I know some APIs have subsets of records that you can specify to limit the response, but I don't see that SWSD has such a capability. I hope this helps.