Account

The Account section of the API represents all the end-points you can use to manage and access the API as well as the login logic you can implement when making some of your own users authenticate.

POST   /api/V1/account/login
GET     /api/V1/account/getToken

Login

When to use it:

This method is used to login a patient (one of your end-users) or yourself.

When successful the login will return a token that can then be used throughout the application to make further requests.

Tips:

  • The login and password strings are required.
  • Make sure you use an HTTPS connection and point to our https endpoint.
import http.client
import json

conn = http.client.HTTPSConnection(“smarttecapi2021.azurewebsites.net”)
payload = json.dumps({
“login”: “yourlogin”,
“password”: “password”
})
headers = {
‘Content-Type’: ‘application/json’,

}
conn.request(“POST”, “/api/V1/account/login”, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8”))

curl –location –request POST ‘https://smarttecapi2021.azurewebsites.net/api/V1/account/login’ \
–header ‘Content-Type: application/json’ \
\
–data-raw ‘{
“login”: “yourlogin”,
“password”: “yourpassword”
}’
var data = JSON.stringify({
“login”: “yourlogin”,
“password”: “yourpassword”
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener(“readystatechange”, function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});

xhr.open(“POST”, “https://smarttecapi2021.azurewebsites.net/api/V1/account/login”);
xhr.setRequestHeader(“Content-Type”, “application/json”);

xhr.send(data);

{
“userID”: “the logged userID”,
“login”: “yourlogin”,
“password”: “”,
“userType”: 0,
“apiToken”: “cQKd9RsSRGFjCETYmdyNh8Nt2eD7VRFEEdyp5SAMgmaadrWU8st2LJ5V4RdVEkwz32WYFeULVdf”
}

getToken

When to use it:

Say you are building an app and want to pass information about a given user.
First you will need that user to login and then you will need to pass the user token for certain requests.
This end-point will give you a fresh token each time the user logs in.

Tips:

  • The user token requested here is returned as part of the login object.
import http.client

conn = http.client.HTTPSConnection(“smarttecapi2021.azurewebsites.net”)
payload = ”
headers = {

}
conn.request(“POST”, “/api/V1/account/getToken?userToken=cQKd9RsSRGFjCETYmdyNh8Nt2eD7VRFEEdyp5SAMgmaadrWU8st2LJ5V4RdVEkwz32WYFeULVdf”, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8”))

curl –location –request POST ‘https://smarttecapi2021.azurewebsites.net/api/V1/account/getToken?userToken=cQKd9RsSRGFjCETYmdyNh8Nt2eD7VRFEEdyp5SAMgmaadrWU8st2LJ5V4RdVEkwz32WYFeULVdf’ \
–header ‘Cookie: ARRAffinity=da3363f6219a86d7191480cb759bc8a0bb5b701fa3394abd6b810baa25bfe8a6; ARRAffinitySameSite=da3363f6219a86d7191480cb759bc8a0bb5b701fa3394abd6b810baa25bfe8a6’
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener(“readystatechange”, function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});

xhr.open(“POST”, “https://smarttecapi2021.azurewebsites.net/api/V1/account/getToken?userToken=cQKd9RsSRGFjCETYmdyNh8Nt2eD7VRFEEdyp5SAMgmaadrWU8st2LJ5V4RdVEkwz32WYFeULVdf”);
xhr.setRequestHeader();

xhr.send();

api/V1/account/getToken?userToken=cQKd9RsSRGFjCETYmdyNh8Nt2eD7VRFEEdyp5SAMgmaadrWU8st2LJ5V4RdVEkwz32WYFeULVdf