Modifier une clé Api
PUT /settings/apikeys/{id}
Paramètres dans l'URL :
| Nom | Description | Type |
|---|---|---|
| id | Id de clé API | String |
Paramètres :
| Nom | Description | Type | Obligatoire |
|---|---|---|---|
| description | Description de la clé API | String | Oui |
| iPFilterEnabled | Restriction IP | Boolean | Non |
| allowedIPs | Tableau d'IP | Array de String | Non |
Réponse :
| Nom | Description | Type |
|---|---|---|
| status | success / failure | String |
Langage de programmation :
Exemple de requête :
{
"description": "My first API key"
}
Exemple de réponse :
{
"status": "success"
}
Exemple de code :
curl -X PUT -d '{"description":"API key description 3"}' -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/64d5ze654ze6f54ezf87fe58
require 'vendor/autoload.php';
$tipimail = new Tipimail\Tipimail('YOUR_SMTP_USERNAME', 'YOUR_API_KEY');
try {
$tipimail->getSettingsService()->getApiKeysService()->updateDescription('646r54g6r4gr6g46g46546d4', 'New description');
$tipimail->getSettingsService()->getApiKeysService()->updateAllowedIps('646r54g6r4gr6g46g46546d4', array('192.168.1.1', '192.168.1.2'));
}
catch(Tipimail\Exceptions\TipimailException $e) {
echo 'Exception received :', $e->getMessage(), "\n";
}