Bad request(400) upon calling the sysaid rest api to log an activity to a service request

 
Author
Message
SysAider
7
 
Somehow the details I filled in seem to be missing, so posting again...

I am trying to use the sysaid rest api. So far I have been able to make two successful api calls. One for login and the other for viewing a service request.

But I am getting a bad request 400 error upon calling the add activity to a service request call.

I am passing the Jsessionid in my header too after logging in.

This is the request url I am using
{mycompany'sdomain}/api/v1/sr/{srno}/activity

this is the body I am setting.
{"user":"myusername","fromTime":"1378501200000","toTime":"1378846800000","description":"blah"}}

Can you please let me know what I am missing?
SysAid Community Manager Product Team
4490
 
Hi anirudh0102,

This is the information I received from R&D:
1. POST request to /api/v1/sr/{srId}/activity
JSON body accoring to the following example:
{"userId":"1","fromTime":"1378501200000","toTime":"1378846800000","description":"bla"}.
Pay attention - the requested user data is user ID, and not user name.

2. PUT request to /api/v1/sr/{srId}
JSON body according to the following example:
{
"id":{srId},
"info": [
{ "key":"activities", "value":""}
]
}

Cheers,
Danny
SysAider
7
 
Thank you. I changed it to user id and my the api call ran successfully. But I don't see the activity on my service request though. Does it take some time to update the data?

Also is the second step (the put request) an alternative to the first step or is it a continuation step?

Thank You,
Anirudh
SysAid Community Manager Product Team
4490
 
From what I understood, it is a continuation.
SysAider
7
 
Thank You. Is this the link to an old document of sysaid rest api? Because I was following the guidelines in this api and some steps work and some don't and some steps are just not there like the continuation step you mentioned.
SysAid Community Manager Product Team
4490
 
I'm not sure, I'll check with R&D, perhaps the guide needs to be updated. To clarify - did this result in successful activity logging?

Thanks,
Danny
SysAider
7
 
No, I haven't finished yet. The First API call ran successfully. But it didn't see anything in the response. So in the continuation step, I don't know what to put for value where the key is activities.
SysAid Community Manager Product Team
4490
 
It should be just as it appears here from what I gather.
SysAider
7
 
Hi Danny,
I got it working, now can add activities to sr, but the inverse does not work.
If i try to delete an activity apparenty all goes fine, querying the activities right after by the sr, the activity is not there anymore.
But in the web portal the activity is present. it does need some form of commit or update to effectively delete an activity ?
SysAider
7
 
I found it, after the del activity DELETE it needs update the sr with a empty list of activities, like this