User API
Use the REST API to interact with EverShop users.
Create a user session
Use this endpoint to create a user session (admin login).
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
string | Yes | |
password | string | Yes |
POST/api/users/sessions
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/users/sessions
fetch('https://<your domain>/api/users/sessions', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
Sample Of Response
{ "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lciI6eyJjdXN0b21lcklkIjoyMiwidXVpZCI6ImQ3YTVlOGI1YTY3MzExZWRiNDZiNjBkODE5MTM0ZjM5Iiwic3RhdHVzIjoxLCJncm91cElkIjoxLCJlbWFpbCI6ImtjMDRBY25MNHU2dUNldDJoSFVxQGVtYWlsLmNvbSIsImZ1bGxOYW1lIjoia2MwNEFjbkw0dTZ1Q2V0MmhIVXEiLCJjcmVhdGVkQXQiOiIyMDIzLTAyLTA3IDE1OjA3OjU1IiwidXBkYXRlZEF0IjoiMjAyMy0wMi0wNyAxNTowNzo1NSJ9LCJzaWQiOiIwOWQzNGMyMS00YWYzLTRkYjgtYTM4Yi0zMzVlYmY2ZDQ1ZmEiLCJpYXQiOjE2NzU2NDk2MTgsImV4cCI6MTY3NTgyMjQxOH0.KVViMcH55nQKHGffvNaVzEENAYS4kEh2xz-KfHHjOWA", "sid": "09d34c21-4af3-4db8-a38b-335ebf6d45fa" }}
Delete a user session
Use this endpoint to delete a user session (admin logout).
Request Schema (application/json)
No request body requiredPOST/api/users/sessions/{id}
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/users/sessions/{id}
fetch('https://<your domain>/api/users/sessions/{id}', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
Sample Of Response
{ "data": {}}