Post

2 followers Follow
0
Avatar

Authentication using Rest API v2.0

I am new to Clarizen and trying to understand how to use Rest APIs v2.0, following the steps in the documentation in "Rest API Guide Version 2".

I am failing to authenticate, and appreciate any information to make this work.

I am using a licensed user with full Admin access and user type is set as "Integration user"

Using this command curl -d '{userName: "user", Password: "****"}' https://api.clarizen.com/v2.0/services/authentication/getServerDefinition to get serverLocation works fine.

However, for the next command (login), using the data center location from above command, I keep getting "Invalid username". curl -d '{userName:"user",password:"****"}' https://api2.clarizen.com/v2.0/services/authentication/login.
I am using the same username/password for both commands.


Am I missing something from fundamental, for using Clarizen APIs?

Does Clarizen need to do any whitelisting of my domain?

Harish Jethwa Answered

Please sign in to leave a comment.

5 comments

0
Avatar

Hello Harish,

When you're logged into Clarizen website via the UI, what does the URL look like? Does it contain app2 or eu1?

Thank you,

Roland

Roland Pumputis 0 votes
Comment actions Permalink
0
Avatar

Hi Roland,

Thanks for your response. When connecting via UI, the URL has https://eu.clarizen…. 

NOTE: I am testing with our Sandbox for now.

With this suggestion, I changed the login API url to eu.clarizen.com/v2.0/services/authentication/login.

This returned with "Could not resolve host: eu.clarizen.com".

So I changed the login API url to eu1.clarizen.com/v2.0/services/authentication/login

This returned with "404 - File or directory not found".

Next I changed the login API url to eu2.clarizen.com/v2.0/services/authentication/login

This did not return any errors, however it did not return any response either. I was looking to get sessionid, userid, etc.

Any suggestions?

Regards

Harish

Harish Jethwa 0 votes
Comment actions Permalink
0
Avatar

Thanks Roland for your update. and this is what I was doing.

Using the getServerDefinition api I get back following response.

curl -d '{userName:"xxxx",Password:"xxxx"}' https://api.clarizen.com/v2.0/services/authentication/getServerDefinition 

{"serverLocation":"https://api2.clarizen.com/v2.0/services","appLocation":"https://app2.clarizen.com/Clarizen","organizationId":0}

So I use this serverLocation api2.clarizen.com for the login api

curl -d '{userName:"xxxx",Password:"xxxx"}' https://api2.clarizen.com/v2.0/services/authentication/login 

The response I get back to this is Invalid username

{"errorCode":"LoginFailure","message":"Invalid username","referenceId":"3tnHFmgpuQy9T4UhGDjqdm"}

As my URL for UI login is eu.clarizentb.com, with your suggestions I tried the following

curl -d '{userName:"xxxx",Password:"xxxx"}' https://apie.clarizentb.com/v2.0/services/authentication/getServerDefinition 

This gave me following response

{"serverLocation":"https://apie.clarizentb.com/v2.0/services","appLocation":"https://eu.clarizentb.com/Clarizen","organizationId":0}

So I use the serverlocation apie.clarizentb.com for the login api

curl -d '{userName:"xxxx",Password:"xxxx"}' https://apie.clarizentb.com/v2.0/services/authentication/login 

The response I get back is still invalid username

{"errorCode":"LoginFailure","message":"Invalid username","referenceId":"muGtYrqOh1n3yusJueFte"}

I must be misunderstanding or missing out something and appreciate your help in resolving this.

Where can I find documentation on which URL to use for API? 

Regards

Harish

 

 

 

 

 

 

 

 

 

 

 

 

Harish Jethwa 0 votes
Comment actions Permalink
0
Avatar

Hi Roland,

The login API worked, using Postman. Until now, I was using curl command in command prompt window and it still does not work using curl command. I do not understand why this is so.

For anyone else having similar issue, the api url it worked with is "https://apie.clarizentb.com/v2.0/services/authentication/login".

Once again Roland, thanks for pointing me in the right direction, much appreciated.

Harish

 

Harish Jethwa 0 votes
Comment actions Permalink