For XML/JSON, follow steps below:
You can authenticate like this:An Administrator user can authenticate as follows. This generated token then needs to be passed in any API function that you execute. To see how to pass the token, refer here.
Code Block | ||
---|---|---|
| ||
http://yourservername:portnumber/psa/api.do?function=login&username=username&password=password&company-code=company code |
For example:
http://acmeindia:8888/psa/api.do?function=login&username=janet&password=diamond45&company-code=acme_com
If data format is XML and your authentication is successful, you will receive XML with two elements: token and user_id. For example:
Code Block | ||
---|---|---|
| ||
<result> <token>a1dc42fb-d420-10feb-aaks9-89f5c0e8sk3c</token> <user_id>112233</user_id> </result> |
In case the data format is JSON, you will receive an object with properties token and user_id respectively.
Code Block |
---|
{"result":{"token":"a1dc42fb-d420-10feb-aaks9-89f5c0e8sk3c","user_id":112233}} |
On how to handle errors, see Error Handling and Debugging