Getting a token
In order to access our API, you must obtain an access token when authenticating a user. Once the token is generated, copy its value and save it in a secure place, since you will not be able to retrieve it again.
To generate an access token, you must send a POST request using the token URL.
name="ENTER_YOUR_NAME"
email="ENTER_YOUR_EMAIL"
comment="ENTER_YOUR_COMMENT"
curl -X 'POST' \
'https://api.metahumansdk.io/auth/token' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'name=${name}&mail=${email}&comment=${comment}'import requests
name = "ENTER_YOUR_NAME"
email = "ENTER_YOUR_EMAIL"
comment = "ENTER_YOUR_COMMENT"
def print_token():
service_url = "http://api.metahumansdk.io/auth"
service_headers = {"accept": "application/json"}
data = {
"name": name,
"mail": email,
"comment": comment
}
response = requests.post(service_url + "/token", headers=service_headers, data=data)
assert (response.status_code == 200)
print(response.json())
if __name__ == "__main__":
print_token()
Expected output:
{'result': {'token': '5775d7ad-d1d3-4aea-83cf-1c14512f70cc'}}Note: Do not forget to replace the details in the request with your own.
Last updated