XL 2016 Problème pour valoriser un Header HTTP

Dudu2

XLDnaute Barbatruc
Bonjour,
Le site Octopush (envoi de SMS) demande de placer dans le Header d'un POST HTTP l'api-key et l'api-login.

1698923000715.png

Et je n'y arrive pas !

1698923053386.png


VB:
Sub a()
    Dim objHTTP As Object
    Dim LoginAPI As String
    Dim CléAPI As String
  
    'Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
    LoginAPI = "moi@domain.com"
    CléAPI = "123abc"
  
    With objHTTP
        .setRequestHeader "Authorization", "api-login: " & LoginAPI, "api-key: " & CléAPI, "cache-control: no-cache"
    End With
End Sub

Une idée ? Merci !
 
Solution
Ok, résolu...
VB:
Sub a()
    Dim objHTTP As Object
    Dim Url As String
    Dim LoginAPI As String
    Dim CléAPI As String
    
    'Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
    LoginAPI = "moi@domain.com"
    CléAPI = "123abc"
    Url = "https://api.octopush.com/v1/public/sms-campaign/send"
    
    With objHTTP
        .Open "POST", Url, False
        .setRequestHeader "Authorization", "api-login: " & LoginAPI & " api-key: " & CléAPI & " cache-control: no-cache"
    End With
    
    MsgBox "ok"
End Sub

Dudu2

XLDnaute Barbatruc
Ok, résolu...
VB:
Sub a()
    Dim objHTTP As Object
    Dim Url As String
    Dim LoginAPI As String
    Dim CléAPI As String
    
    'Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
    LoginAPI = "moi@domain.com"
    CléAPI = "123abc"
    Url = "https://api.octopush.com/v1/public/sms-campaign/send"
    
    With objHTTP
        .Open "POST", Url, False
        .setRequestHeader "Authorization", "api-login: " & LoginAPI & " api-key: " & CléAPI & " cache-control: no-cache"
    End With
    
    MsgBox "ok"
End Sub
 

Membres actuellement en ligne

Aucun membre en ligne actuellement.

Statistiques des forums

Discussions
314 628
Messages
2 111 337
Membres
111 104
dernier inscrit
JEMADA