For developers


Check promocode

In order to check your promocode you need to send a cURL request to:

https://promoholder.tech/api/checkPromocode?token={your_token}&company={company_ID}&code={code}

You will receive a response in JSON format containing the keys:


Key
Value
Explanation

type
string
The result type of the query execution. This can be either "success" (though this does not necessarily mean that the promocode was applied) or "error" (for example, if you sent an invalid token). All responses with "type": "error" are not registered in the API Journal!

msg
bool / string
The result description of the query execution. For queries with "type": "error" this is always a string that contains an explanation of the reason for the error. If the query was successful, msg contains a Boolean variable (true if promocode was used, and false if not)

reason
null / string
This key is always null except for responses with "msg": false, (in this case, it is a string). The reason is needed to explain why the promocode was not used

Examples:

        
        // Error
        {
            "type": "error",
            "msg": "Token not passed"
        }
            
        // Code wasnt used
        {
            "type": "success",
            "msg": false,
            "reason": "Promocode is not active"
        }
            
        // Code was used
        {
            "type": "success",
            "msg": true
        }
            
      
Get the companies

To get a list of your companies, you need to send a cURL request to:

https://promoholder.tech/api/getCompanies?token={your_token}

You will receive a response in JSON format containing the keys:


Key
Value
Explanation

type
string
The result type of the query execution. This can be either "success" (though this does not necessarily mean that the promocode was applied) or "error" (for example, if you sent an invalid token). All responses with "type": "error" are not registered in the API Journal!

msg
null / string / array
The result description of the query execution. For queries with "type": "error" this is always a string that contains an explanation of the reason for the error. If the request was successful, the msg contains an array of company objects, or if no companies were found, just null

ID
string
This is the company ID that you can use to interact with other API methods

title
string
Company name

promocodes
obj
The key contains information about the number of promocodes of the company

all
int
Total number of company promocodes

active
int
Number of active promocodes of the company

deactive
int
Number of deactivated promocodes of the company

Examples:

        
        // Error
        {
            "type": "error",
            "msg":  "Token not passed"
        }
            
        // Companies list
        {
            "type": "success",
            "msg": [
                    {
                        "ID": "somelongstringoftextandnumbers",
                        "title": "Company name",
                        "promocodes": {
                                        "all": 100,
                                        "active": 51,
                                        "deactive": 49
                                      }
                    },
                    {
                    ...
                    }
                 ]
        }
            
      
Get promocodes

To get a list of all your promocodes or promocodes for a specific company, you need to send cURL request to:

https://promoholder.tech/api/getPromocodes?token={your_token}[&company={company_ID}]

You will receive a response in JSON format containing the keys:


Key
Value
Explanation

type
string
The result type of the query execution. This can be either "success" (though this does not necessarily mean that the promocode was applied) or "error" (for example, if you sent an invalid token). All responses with "type": "error" are not registered in the API Journal!

msg
null / string / obj
The result description of the query execution. For queries with "type": "error" ithis is always a string that contains an explanation of the reason for the error. If the request was successful, the msg contains an object whose properties are the ID (hereinafter $ID) of the companies the promocodes are grouped by. If no promocodes are found, msg will be just null

$ID
array
Array of promocodes objects for the companies whose ID is identical to $ID. If you sent the GET parameter company , you will get only promocodes from this company. Otherwise, you will get all of them

code
string
The code of promocode

limit
null / int
Limit of available promocodes. If null, the promocode is unlimited. Otherwise the value has an int type

timezone
string
Timezone represented in the Area/Location format

dtime_s
null / string
Date and time when the promocode period starts (format Y-m-d H:i:s). If omitted, then it is null

dtime_f
null / string
Date and time when the promocode validity period ends (Y-m-d H:i:s format). If omitted, then it is null

active
bool
Promocode activity statement

Examples:

        
        // Error
        {
            "type": "error",
            "msg":  "Token not passed"
        }
            
        // Promocodes list
        {
            "type": "success",
            "msg": {
                    "somelongstringoftextandnumbers": [
                                                         {
                                                            "code": "PROMOCODE",
                                                            "limit": 10,
                                                            "timezone": "Europe/Moscow",
                                                            "dtime_s": "2020.01.01 00:00:00",
                                                            "dtime_f": "2020.01.01 01:00:00",
                                                            "active": true,
                                                         },
                                                         {...}
                                                      ],
                    "somelongstringoftextandnumbers2": [...]                                 
                 }
        }