Add api key
POST /settings/apikeys
Parameters:
| Name | Description | Type | Mandatory |
|---|---|---|---|
| description | API key description | String | Yes |
| iPFilterEnabled | Restriction IP | Boolean | No |
| allowedIPs | Array of IP | Array of String | No |
Response:
| Name | Description | Type |
|---|---|---|
| id | API key Id | String |
| hash | Login | String |
| key | Password | String |
| iPFilterEnabled | If ip filter is enabled | Boolean |
| allowedIPs | Array of IP | Array |
| description | Description | String |
| createdAt | Datetime on timestamp format | Int |
| updatedAt | Datetime on timestamp format | Int |
| enabled | If the API key is enabled or not | String |
Programming language:
Request exemple:
{
"description": "My first API key"
}
Response exemple:
{
"id": "5f6ze54f6ze54f6ze5f4ze74",
"hash": "fe6z45f6ze5f4ez6f4ze6f54zef9c5d8",
"key": "3fzefze987f9ze8f7ze65f4ze654fzeb0",
"iPFilterEnabled": true,
"allowedIPs": [192.168.1.1],
"description": "Application",
"updatedAt": 1438768285,
"enabled": true
}
Code example:
curl -X POST -d '{"description":"test","ipFilterEnabled":false,"allowedIps":[]}' -H "Content-Type: application/json" -H "X-Tipimail-ApiUser:YOUR_SMTP_USERNAME" -H "X-Tipimail-ApiKey:YOUR_SMTP_KEY" https://api.tipimail.com/v1/settings/apikeys
require 'vendor/autoload.php';
$tipimail = new Tipimail\Tipimail('YOUR_SMTP_USERNAME', 'YOUR_API_KEY');
try {
$result = $tipimail->getSettingsService()->getApiKeysService()->add('Description');
var_dump($result);
}
catch(Tipimail\Exceptions\TipimailException $e) {
echo 'Exception received :', $e->getMessage(), "\n";
}