SMS Pro - Problème requête API SMS
... / Problème requête API SMS
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Frage

Problème requête API SMS

Von
M.P2
Erstellungsdatum 2024-01-22 13:39:59 (edited on 2024-09-04 12:49:18) in SMS Pro

Bonjour à toutes et à tous,

J'utilise le SDK php pour l'API d'envoi de SMS.
J'ai bine installé via composer le SDK d'OVH.
Quand je test en utilisant la console de l'API proposé par OVH tout fonctionne bien. Je récupéré le code PHP de la console et quand je le test directement j'ai une erreur :
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error response [url] https://api.ovh.com/1.0/sms/sms-bj128429-1/jobs [status code] 400 [reason phrase] Bad Request in C:\wamp64\www\xxx\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 89
( ! ) GuzzleHttp\Exception\ClientException: Client error response [url] https://api.ovh.com/1.0/sms/sms-bj128429-1/jobs [status code] 400 [reason phrase] Bad Request in C:\wamp64\www\xxx\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 89


Voici le script récupéré de la console
require './vendor/autoload.php';
use \Ovh\Api;





$ovh = new Api( "xxxxx", // Application Key
"xxxxx", // Application Secret
"ovh-eu", // Endpoint of API OVH Europe (List of available endpoints)
"xxxx"); // Consumer Key

$result = $ovh->post('/sms/sms-bj128429-1/jobs', array(
'charset' => 'UTF-8', // The sms coding (type: sms.CharsetEnum)
'class' => NULL, // Deprecated: The sms class (type: sms.ClassEnum)
'coding' => '7bit', // Deprecated: the coding is deduced from the message and its charset (type: sms.CodingEnum)
'differedPeriod' => NULL, // The time -in minute(s)- to wait before sending the message (type: long)
'message' => 'Voici votre message', // The sms message (type: string)
'noStopClause' => true, // Do not display STOP clause in the message, this requires that this is not an advertising message (type: boolean)
'priority' => NULL, // The priority of the message (type: sms.PriorityEnum)
'receivers' => '["+336XXXXXXXX"]', // The receivers list (type: string[])
'receiversDocumentUrl' => NULL, // The receivers document url link in csv format (type: string)
'receiversSlotId' => NULL, // The receivers document slot id (type: string)
'sender' => 'XXXX.fr', // The sender (type: string)
'senderForResponse' => false, // Set the flag to send a special sms which can be reply by the receiver (smsResponse). (type: boolean)
'tag' => NULL, // The identifier group tag (type: string)
'validityPeriod' => NULL, // The maximum time -in minute(s)- before the message is dropped (type: long)
));
print_r( $result );

Il semble que cela vienne d'un script tiers utilisé par le SDK. Avez-vous été confronté au même pb ?

Merci d'avance pour vos réponses.


2 Antworten ( Latest reply on 2024-01-29 09:52:00 Von
^FabL
)

En fait le problème vient des droits liés aux clés API. En ajoutant POST sms/* cela fonctionne.

Bonjour @M.P2,

Je vous remercie d'avoir répondu à votre propre thread avec la réponse,

Passez une excellente semaine,

^FabL

Antworten sind derzeit für diese Frage deaktiviert.