Documentation forSolarWinds Service Desk

Contracts

Getting a list of all contracts items:

curl -H "X-Samanage-Authorization: Bearer TOKEN" -H 'Accept: application/vnd.samanage.v2.1+xml' -X GET

https://api.samanage.com/contracts.xml

Getting contract details (using contract ID number):

curl -H "X-Samanage-Authorization: Bearer TOKEN" -H 'Accept: application/vnd.samanage.v2.1+xml' -X GET https://api.samanage.com/contracts/ITEM_ID.xml

Create a new contract:

curl -H "X-Samanage-Authorization: Bearer TOKEN" -d 'INPUT_XML' -H 'Accept: application/xml' -H 'Content-Type:text/xml' -X POST https://api.samanage.com/contracts.xml

Required fields:

<name>,<type>,<status>,<manufacturer_name>,<type>

XML Example:

<contract>

  <type>SoftwareLicense</type>
  <end_date>2013-01-01T00:00:00-06:00</end_date>
  <manufacturer_name>Manufacturer name</manufacturer_name>
  <name>Contract title</name>
  <note>Note</note>
  <start_date>2012-01-01T00:00:00-06:00</start_date>
  <status>Active</status>
  <site><name>Site name</name></site>

  <department><name>Department name</name></department>

  <custom_fields_values>

    <custom_fields_value>

      <name>field name</name>

      <value>content</value>

    </custom_fields_value>

    <custom_fields_value>

      <name>field name</name>

      <value>content</value>

    </custom_fields_value>

  </custom_fields_values>
</contract>

JSON Example:

{

  "contract":{

    "type":"SoftwareLicense",

    "end_date":"2015-01-01T00:00:00-06:00",

    "manufacturer_name":"manufacturer name",

    "name":"Contract title",

    "note":"note",

    "start_date":"2015-01-01T00:00:00-06:00",

    "status":"Active",

    "site":{"name":"site name"},

    "department":{"name":"department name"},

    "custom_fields_values":{

    "custom_fields_value":[

      {"name":"field_name","value":"content"},

      {"name":"field_name","value":"content"}]

    }

  }

}

Updating a contract:

curl -H "X-Samanage-Authorization: Bearer TOKEN" -d 'INPUT_XML' -H 'Accept: application/xml' -H 'Content-Type:text/xml' -X PUT https://api.samanage.com/contracts/CONTRACT_ID.xml

XML Example:

<contract>

  <field_to_update>content</field_to_update>

</contract>

JSON Example:

{

"contract": {

"field_to_update": "content",

}

}