API Commands

Using OAuth Application

Create an API on “www.awetest.com/management/api” (Refer to the documentation describing the process to create) and use the API information in the following commands

 

  1. To get access token

curl -X POST -d "client_id=<ApplicationId>&client_secret=<Secret>&grant_type=authorization_code&code=<Code>&redirect_uri=<CallbackURL>" http://www.awetest.com/oauth/token

 

Sample JSON response:

{"access_token":"f1b3246c88f5dfcad6ed3373a592e0550c68e058d53857dcc6a31a5e615a2cba","token_type":"bearer","expires_in":7200,"refresh_token":"69d547900fe66c1325f7f26210cd639a78e145768a358f1b03eed8d642da5467","scope":"public"}

 

  1. To make a request for the required API, we can execute either of the following commands 

curl --header "Authorization: Bearer <AccessToken>" http://www.awetest.com/api/v1/projects.json

OR

 

curl http://www.awetest.com/api/v1/projects.json?access_token=<AccessToken>

 

OR

 

Try this in a browser

http://www.awetest.com/api/v1/projects.json?access_token=<AccessToken>

 

  1. To request for a new access token with the help of refresh token 

curl -X POST -d "client_id=<ApplicationId>&client_secret=<Secret>&redirect_uri=<CallbackURL>&grant_type=refresh_token&refresh_token=<RefreshToken>" http://www.awetest.com/oauth/token

  

Sample JSON response:

{"access_token":"f1b3246c88f5dfcad6ed3373a592e0550c68e058d53857dcc6a31a5e615a2cba","token_type":"bearer","expires_in":7200,"refresh_token":"69d547900fe66c1325f7f26210cd639a78e145768a358f1b03eed8d642da5467","scope":"public"}

 

 

 

Without using OAuth Application

If we provide the username and password directly, then we need not create any OAuth application. We can obtain the access token directly by making use of following curl command

 

curl -X POST -d "grant_type=password&username=<Username>&password=<Password>" http://www.awetest.com/oauth/token

 

Sample JSON response:

{"access_token":"f1b3246c88f5dfcad6ed3373a592e0550c68e058d53857dcc6a31a5e615a2cba","token_type":"bearer","expires_in":7200,"refresh_token":"69d547900fe66c1325f7f26210cd639a78e145768a358f1b03eed8d642da5467","scope":"public"}

 

 

Get report status using API

Command:

curl http://www.awetest.com/api/v1/jobs/<JobID>.json?access_token=<AccessToken>

 

Sample response:

{"id":4941,"status":"finished","total_scripts":2,"test_runs":[{"id":12539,"status":"Fail"},{"id":12540,"status":"Fail"}],"total_scripts_completed":2}

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk