Purchases
Create a new purchase (and add it to an existing contract / hardware / other asset):
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|hardwares|other_assets]/[CONTRACT_ID|HARDWARE_ID|OTHER_ASSET_ID]/purchases.xml
XML Example:
<purchase>
<number>123</number>
<date>Dec 11, 2012</date>
<recurrence>Monthly</recurrence>
<total_cost>100</total_cost>
<currency>USD</currency>
<notes>notes</notes>
<vendor><name>Vendor</name></vendor>
</purchase>
JSON Example:
{
"purchase": {
"number": "123",
"date": "Dec 11, 2012",
"recurrence": "Monthly",
"total_cost": 100,
"currency": "USD",
"notes": "Notes",
"vendor": {"name": "Vendor"}
}
}
Updating a purchase:
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|hardwares|other_assets]/[CONTRACT_ID|HARDWARE_ID|OTHER_ASSET_ID]/purchases/PURCHASE_ID.xml
XML Example:
<purchase>
<field_to_update>content</field_to_update>
</purchase>
JSON Example:
{
"purchase": {
"field_to_update": "content",
}
}
Deleting a purchase:
curl -H "X-Samanage-Authorization: Bearer TOKEN" -H 'Accept: application/vnd.samanage.v2.1+xml' -X DELETE https://api.samanage.com/[contracts|hardwares|other_assets]/[CONTRACT_ID|HARDWARE_ID|OTHER_ASSET_ID]/purchases/PURCHASE_ID.xml