Login and Logout¶
This document provides information about the login and logout endpoints for the ISPCRM API, which allows authenticated access to the system using a Bearer Token.
1. Login¶
Endpoint¶
POST /api/v1/subscriber/Login
This endpoint is used to authenticate a subscriber and obtain a JWT token for accessing other endpoints.
Request Body¶
- Content-Type:
application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | Yes | Subscriber’s username. |
password | string | Yes | Subscriber’s password. |
Example Request¶
curl -X POST "https://yourispcrmdomain/api/v1/subscriber/Login" \
-H "Content-Type: application/json" \
-d '{
"username": "subscriber123",
"password": "password123"
}'
Success Response (200 OK)¶
{
"message": "Login successful",
"token": "eyJhbGciOiJIUzI1...",
"subscriber": {
"id": 1,
"customer_id": "12345",
"username": "subscriber123",
"firstname": "John",
"lastname": "Doe"
}
}
Explanation: - message - Indicates if the login was successful. - token - JWT token to be used in subsequent API requests. - subscriber - Contains subscriber details: - id - Unique ID of the subscriber. - customer_id - Customer ID assigned. - username - Subscriber’s username. - firstname - Subscriber’s first name. - lastname - Subscriber’s last name.
Error Responses¶
401 Unauthorized¶
{
"message": "Invalid credentials"
}
Explanation: - This error occurs if the username or password is incorrect.
Example Response¶
{
"message": "Login successful",
"token": "eyJhbGciOiJIUzI1...",
"subscriber": {
"id": 1,
"customer_id": "12345",
"username": "subscriber123",
"firstname": "John",
"lastname": "Doe"
}
}
2. Logout¶
Endpoint¶
POST /api/v1/subscriber/Logout
This endpoint is used to terminate the authenticated session by invalidating the Bearer Token.
Authorization¶
- Type: Bearer Token
- Header:
Authorization: Bearer <your_token_here>
Example Request¶
curl -X POST "https://yourispcrmdomain/api/v1/subscriber/Logout" \
-H "Authorization: Bearer YOURAPITOKENHERE"
Success Response (200 OK)¶
{
"message": "Logout successful"
}
Explanation: - message - Confirmation that the logout was successful.
Error Responses¶
401 Unauthorized¶
{
"message": "Invalid credentials"
}
Explanation: - This error occurs if the Bearer Token is invalid or expired.
Example Response¶
{
"message": "Logout successful"
}
Summary¶
- Login is used to obtain a JWT token for authenticated API access.
- Logout is used to invalidate the JWT token and end the session.
For further assistance, contact our support team at support@netgroot.com.