Subscription Validation
Description
Go-math-science.com allows the use of its REST APIs.
- registration_id: this is the user name of the subscriber used for the subscription
- subscription_method:
referer
orip
. Ifreferer
, then the domain name will be validated to authorise it according to the subscription. Ifip
, then the sourceip
will be a validated to authorise it according to the subscription.
Parameters
- registration_id (string, required): the registration id, which is the user name, registered in the website
- subscription_method (string, required): the subscription method will be either referrer or ip
Error Codes
-
400 Bad Request
-
Description: Indicates that the request is missing required parameters or contains invalid parameter values.
-
Conditions:
- Missing
registration_id
parameter. - Missing
subscription_method
parameter. - Invalid
subscription_method
value (must be eitherreferer
orip
).
- Missing
-
Example Responses:
- Missing
registration_id
:{ "valid": false, "code": 400, "message": "Missing registration_id parameter" }
- Missing
subscription_method
:{ "valid": false, "code": 400, "message": "Missing method parameter" }
- Invalid
subscription_method
value:{ "valid": false, "code": 400, "message": "Invalid method parameter value. Allowed values are 'referer' or 'ip'" }
- Missing
-
-
401 Unauthorized
-
Description: Indicates that the subscription is either inactive, expired, or the request comes from an unauthorized domain or IP address.
-
Conditions:
- Subscription is not active.
- Subscription is expired (current date is outside the subscription validity period).
- Unauthorized referer domain.
- Unauthorized source IP address.
-
Example Responses:
- Inactive subscription:
{ "valid": false, "code": 401, "message": "Subscription for user123 is not active" }
- Expired subscription:
{ "valid": false, "code": 401, "message": "Subscription for user123 is expired" }
- Unauthorized referer domain:
{ "valid": false, "code": 401, "message": "Referer domain example.com is not authorized" }
- Unauthorized source IP address:
{ "valid": false, "code": 401, "message": "Source IP address 192.168.1.1 is not authorized" }
- Inactive subscription:
-
-
404 Not Found
-
Description: Indicates that the user is not registered or there is no subscription for the user.
-
Conditions:
- User is not registered.
- No subscription found for the user.
-
Example Responses:
- User not registered:
{ "valid": false, "code": 404, "message": "User user123 is not registered in the website. It must be registered first then subscribed" }
- No subscription for the user:
{ "valid": false, "code": 404, "message": "There is no subscription for user123"
- User not registered:
-
Document Actions