Unable to login using SysAid API

  • 13 March 2017
  • 7 replies
  • 650 views

  • Community Enthusiast
  • 9 replies
Hi. I'm using postman to make a post call to https://mycompanyname.sysaidit.com/api/v1/login

and adding on the login parameters as,

https://mycompanyname.sysaidit.com/api/v1/login?user_name=GivenuserName&password=GivenPassword

and I keep getting this error. Any idea how can I get it to working? I'm using postman to make this test call.

HTTP Status 500 - Request failed.

type Status report

message Request failed.

description The server encountered an internal error that prevented it from fulfilling this request.

SysAid Server/17.1.60

7 replies

Make sure you have interceptor to hold on to the cookies for subsequent requests.

Also, ensure that you've specified that you're sending Text JSON format.
Hi Thank you for your reply. I got it working by removing the username and the password from the request URL and instead making it a part of the request body.

Here's how it goes,

POST call to;
https://mycompanyname.sysaidit.com/api/v1/login

set the Headers to : "Content-Type: application/json"

Body:
{ "user_name": "AddUserNameHere",
"account_id": "AddAccountIDHere",
"password" : "AddPasswordHere"
}

Hope this helps!
Userlevel 2
Badge
Qasim
...POST call to;
https://mycompanyname.sysaidit.com/api/v1/login

set the Headers to : "Content-Type: application/json"

Body:
{ "user_name": "AddUserNameHere",
"account_id": "AddAccountIDHere",
"password" : "AddPasswordHere"
}
...
Thank you very much for sharing this here on the Community Qasim!
For the sake of anyone else looking to log in to the REST API, some more info:

Logging in to the REST API is performed in the manner Qasim has described - an HTTP POST request to the "/api/v1/login" endpoint for your SysAid Server instance, with the single header "Content-Type: application/json".
Example HTTP POST Request for login:
POST /api/v1/login HTTP/1.1
HOST: my.sysaidserver:8080
content-length: 69
content-type: application/json

{"user_name": "username", "account_id": "account", "password": "password"}
Upon a successful login, you will receive a HTTP 200 OK response and a "Set-Cookie" header will be in the Response Headers.
Example Response Headers:
Content-Length: xxxx
Content-Type: application/json
Date: Sun, 1 Jan 2017 12:34:56 GMT
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=77765667E6A6D9EA4199339DEF16471C; Path=/; HttpOnly
The "JSESSIONID" component is your Session ID which must be sent along with each subsequent request to the REST API in your Request Headers as the "Cookie" header.
Example HTTP GET request for loading an SR (in this case ID #1234):
GET /api/v1/sr/1234 HTTP/1.1
HOST: my.sysaidserver:8080
content-type: application/json
cookie: JSESSIONID=77765667E6A6D9EA4199339DEF16471C

I hope this information is clear and helpful to any and all!

Cheers!
Cael
i have tried these urls
https://mycompanyname.sysaidit.com/api/v1/login
https://mycompanyname.sysaidit.com/api/v1/login?us...serName&password=GivenPassword

i am getting the error:
HTTP Status 405 - Method Not Allowed

type: Status report
message: Method Not Allowed
description: The specified HTTP method is not allowed for the requested resource.

SysAid Server/17.4.50

please guide me for the troubleshoot.
Userlevel 2
Badge
Neeraj
...
i am getting the error:
HTTP Status 405 - Method Not Allowed
...
Hi Neeraj,

Considering the 405 you are encountering, I suspect that you are not sending the HTTP request using the POST method.

.../api/v1/login expects a POST HTTP request, with the Account ID, Username and Password values in the request body as a JSON string (see my previous post for more detailed explanation).
You can investigate further and speed up testing using a browser based HTTP Request Tester add-on/extension, such as Advanced REST Client (ARC), PostMan or other similar desktop/command line tools.

Hope this information assists you!
Cheers, Cael
Encountering a similar issue with the REST API. I successfully logged into the API with Postman, but in C# with the same settings as Postman I am getting a StatusCode of "NotFound". Are there any examples of logging into the API with C#?

Thanks!
Hi there,

I'm trying too to post /login but since a few days the request timeouts (504). It used to work fine before.

Anybody had the same issue?

Thanks

Reply