- Login using the given credentials.
- Get the list of all users and store them in a file called
users.json. - Add the currently logged in user to the list of users.
-
To log in we need to send a GET request to this url:
https://challenge.sunvoy.com/login. And get thenoncecode from the response given by the server in html format. -
Make a POST request to this url:
https://challenge.sunvoy.com/loginwith the credentials and thenoncecode as the body. -
Get the JSESSIONID from the response headers and store it in a variable.
-
Make a POST request to this url:
https://challenge.sunvoy.com/api/userswith the JSESSIONID in the header. -
Get the list of all the users and store them in a variable.
-
Make a GET request to this url:
https://challenge.sunvoy.com/settings/tokenswith the JSESSIONID in the header. -
From the response get the following values and store them in an object:
access_token,openId,userId,apiuser,operateId,language. -
Create a checkcode using the values of
access_token,openId,userId,apiuser,operateId,languageand the current timestamp. -
Make a POST request to this url:
https://api.challenge.sunvoy.com/api/settingswith all the data and the check code in the body. -
Get the response from the server and append the current user to the list of users and save the list of users in a file called
users.json.
Video: https://www.loom.com/share/4133ccf512eb4617972138133efa04af?sid=b36ace80-73f2-4b0a-b5d6-bec77a8375ef
The project took me a little over 5 hours to finish.