I don’t know Python so I can’t help on that front. And I really only know the extreme basics of Bash but in case it helps this is a call I have that updates the status of an asset.
AssetStatus=$(curl -sX POST --location 'https://YOURDOMAIN.incidentiq.com/api/v1.0/assets/bulk/set-status' \
--header 'accept: application/json, text/plain, */*' \
--header 'content-type: application/json' \
--header 'SiteId: '$siteId'' \
--header 'productid: '$ticketingProductId'' \
--header 'Authorization: Bearer '$iiqToken'' \
--data '{
"AssetIds": d "'$assetId'" ],
"Request": {
"AssetId": "'$assetId'",
"AssetStatusTypeId": "84d9874b-2eea-4748-3c1a-e58f75125b89"
}
}')
Now, that said, in the case of Retiring devices I set up a rule for mine that if the status of a device is changed to retired it automatically sets all the other information I want. (In my case remove client, set a specific location/room. No API required in that case (though technically anyone with edit asset rights could do that if that’s a problem.)
Thank you @iljared98 for submitting your question to our Community.
For a request such as this, I will direct you to submit a ticket to support. They are the best equipped to assist you with this request.
Also, shout out to @bclark for helping with this!
@MattHenry is a API wizard who might be able to assist there!
You can try this.
from datetime import datetime
current_date = datetime.now().strftime("%Y-%m-%d") # Today's date in required format
update_endpoint = f"/assets/{asset_sid}/update"
update_payload = {
"status": "Retired",
"purchase_information": {
"retired_date": current_date # Assuming the API field is 'retired_date'
}
}
response = requests.post(update_endpoint, json=update_payload)