Last Modified October 7, 2021
- Home
- RESTful API
- Credits Query
Use the Credits Query
API to receive the current status of the Credits
for a given License Code and/or Buyer Email.
The API will return an array of all the Credits for the specified <target>
(LICENSE, EMAIL, or ALL)
HTTP Verb |
Element |
Syntax |
GET |
URL |
https://api.softworkz.com/v1/credits/<productId>/<licenseId> |
Body |
{
"Target":"<target>",
"UserIp":"<userIp>"
"Test":"<test>",
"SendDnaEmail":"<SendDnaEmail>",
}
|
Return the <Count> of each Credit type associated
with the <Target>
Possible Targets:
- LICENSE - applies to credits associated with the License Code
- EMAIL - applies to credits associated with the Buyer Email of this License Code
- ALL - applies to credits associated with both the License Code and the Buyer Email.
You must provide the End User IP Address in the body of the Request.
The IP Address is used to protect your implementation and this API from abuse
and is only used to manage the IP Lockout feature of this API.
The IP Lockout will be triggered after multiple invalid attempts in a given period, and a set cooling period will be enacted.
Both are system-wide settings.
|
Where:
Parameter |
Type |
Value |
Required |
Default |
<productId> |
string |
the DNA ProductID |
Yes |
|
<licenseId> |
string |
the License Activation Code |
Yes |
|
<target> |
string |
LICENSE or EMAIL or ALL |
Yes |
|
<userIp> |
string |
the User's IP Address, for protection against end-user abuse |
Yes |
|
<Test> |
bool |
if true , this is a Test Event |
No |
false |
<SendDnaEmail> |
bool |
if true , software_DNA will send Custom Emails to the old and new Email addresses to notify User
of the change to the License Email |
No |
true |
The Credits Query API returns the updated status of the Credits in JSON format:
[
{
"Target": "<target1>",
"Name": "<creditName1>",
"Count": "<count1>"
},
{
"Target": "<target2>",
"Name": "<creditName2>",
"Count": "<count2>"
}
]
API Response
Success HTTP Status Code |
Description |
200 OK |
Credits Status JSON string is returned in Response |
Error HTTP Status Code |
Description |
400 Bad Request |
one of the parameters was invalid or missing - check error message in Response for details |
401 Unauthorized |
Basic Authentication failed - verify that you are using the correct <clientId> and <apiKey> information in the
Basic Authentication Header |
403 Forbidden |
The <Target> did not have sufficient Credits |
404 Not Found |
The <productId> and/or the <licenseId> was not found |
429 Too Many Requests |
You have exceeded the allowed maximum of API Requests in the period - check "X-RateLimit-Reset" for the
number of seconds remaining before reset |
500 Internal Error |
An error occured on the DNA Server - try again later. Tech Support has been notified |
Examples of API Requests
GET Credits Query example - returns status of the Credits
curl -v -X GET https://api.softworkz.com/v1/credits/<productId>/TEST12345
-H "Accept: application/json"
-u "<clientId>:<API Key>"
-d ’{"Target":"LICENSE","UserIp":"0.0.0.0"}’
Example of API Response with Credits Query
[
{
"Target": "LICENSE",
"Name": "Reports",
"Count": 5
},
{
"Target": "EMAIL",
"Name": "Reports",
"Count": 2
}
]
Example of API Error Response
{
"Message": "Invalid ProductId format"
}