Get User Info
This endpoint allows you to retrieve information about the user associated with the token.
Endpoint
GET: https://api.smart-mfg.net/user
Example Request (Python)
import requests
token = "YOUR_GENERATED_TOKEN"
headers = {
"Authorization": f"Bearer {token}",
"Accept": "application/json"
}
response = requests.get("https://api.smart-mfg.net/user", headers=headers)
print(response.json())
if 200 <= response.status_code < 300:
print("Token is valid!")
else:
print("Failed to authenticate token.")
Example Response (JSON)
- Response Code:
200 OK: Successful request - See below for a description of these values
{
"data": {
"id": 12345,
"name": "Example User",
"email": "example@smart-mfg.net",
"active_company": {
"id": 1,
"name": "Acme Company 1",
"avatar": "https://api.smart-mfg.net/storage/companies/fake-avatar.png"
},
"companies": [
{
"id": 1,
"name": "Acme Company 1",
"avatar": "https://api.smart-mfg.net/storage/companies/fake-avatar.png"
},
{
"id": 2,
"name": "Acme Company 2",
"avatar": "https://api.smart-mfg.net/storage/companies/fake-avatar.png"
}
]
}
}
Values & Description
| Key | Type | Description |
|---|---|---|
| data | object | Contains user data |
| data.id | integer | Unique identifier for the user |
| data.name | string | Name of the user |
| data.email | string | Email address of the user |
| data.active_company | object | This is the last company that was set, and the one the API will return information amount |
| data.active_company.id | integer | Unique identifier for the active company |
| data.active_company.name | string | Name of the active company |
| data.active_company.avatar | string (URL) | URL of the active company's avatar image |
| data.companies | array | List of all companies associated with the user |
| data.companies.*.id | integer | Unique identifier for a company |
| data.companies.*.name | string | Name of a company |
| data.companies.*.avatar | string (URL) | URL of the company's avatar image |