Invalid X-Ovh-Timestamp header
... / Invalid X-Ovh-Timestamp header
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.
question

Invalid X-Ovh-Timestamp header

Par
GillesP35
Créé le 2023-04-24 08:06:12 (edited on 2024-09-04 14:02:33) dans SMS Pro

Bonjour,

J’utilise POSTMAN pour tester l’API SMS et j’ai systématiquement une erreur concernant le Timestamp.

Voici mon code :
const AK = "akakakakakakakak";
const AS = "asasasasasasasasasasasasasasasas";
const CK = "ckckckckckckckckckckckckckckckck";

const serviceName = "sms-pg000000-1";
const METHOD = "POST";
const QUERY = https://eu.api.ovh.com/1.0/sms/+ serviceName + "/jobs";
const BODY = JSON.stringify({"charset": "UTF-8", "receivers": [ "+33600000000" ], "message": "Test SMS OVH", "priority": "high", "senderForResponse": true, "sender":"SENDER_NAME"});

let currentDate = new Date();
let timestamp = Math.floor(currentDate.getTime() / 1000);
console.log(timestamp.toString())

const message = AS + "+" + CK + "+" + METHOD + "+" + QUERY + "+" + BODY + "+" + timestamp.toString();
console.log(message)

let encrypted = CryptoJS.SHA1(message);

let signature = "$1$" + encrypted;
console.log(signature)

pm.request.addHeader("X-Ovh-Application", AK);
pm.request.addHeader("X-Ovh-Consumer", CK);
pm.request.addHeader("X-Ovh-Signature", signature);
pm.request.addHeader("X-Ovh-Timestamp", timestamp.toString());

Et voici l’erreur:

{
"message": "Invalid X-Ovh-Timestamp header",
"httpCode": "400 Bad Request",
"errorCode": "INVALID_HEADER"
}

Sauriez vous m’aider à trouver l’erreur, svp ?

Merci par avance.

Gilles


1 réponse ( Latest reply on 2024-12-17 10:45:44 Par
fritz2cat 🇧🇪 🇪🇺
)

Bonjour,

Je rencontre une erreur similaire

Error: 400 Bad Request

  • {"class":"Client::BadRequest","message":"Invalid X-Ovh-Timestamp header","httpCode":"400 Bad Request","errorCode":"INVALID_HEADER"}

Une idée depuis le temps ?

Joyeuse fêtes :-)

 

Séb

C'est un vieux message qui ressort par magie ? Je n'ai pas compris ...