GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WINDEV 2024
→
httpsend
httpsend
Iniciado por kel, nov., 05 2020 10:01 PM - 3 respostas
Conecte-se…
kel
#1
Publicado em novembro, 05 2020 - 10:01 PM
Hi I need to do the below
To retrieve an API Token
Make a POST request to https://api.borderexpress.com.au/token with a header of: "Content-Type: application/x-www-form-urlencoded".
The entered request body should contain your URL encoded credentials in the format of:
grant_type=client_credentials&client_id={clientId}&client_secret={clientSecret}
If successful a result will be returned in JSON:
{ "access_token":"****", "token_type":"bearer", "expires_in":3599, "scope":"bex.webapi.basic", "userName":"username@borderexpress.com.au", ".issued":"Tue, 29 Aug 2017 05:45:16 GMT", ".expires":"Tue, 29 Aug 2017 06:45:16 GMT" }
For setup and testing purposes please connect to our test API https://integrationapi.borderexpress.com.au.
In order to request access to our API please email integrations@borderexpress.com.au and provide an email address to link to your API account.
After testing is complete and you are ready to deploy to live, please utilise our production API https://api.borderexpress.com.au
and my code is
myrequest is httpRequest
myrequest..Method = httpPost
myrequest..Header["Authorisation"] = "client_id=ec24ff28.880f.4dfd.8c70.03c7ba8a6030"
myrequest..ContentType = "application/x-www-form-urlencoded"
myrequest..URL = "
https://api.borderexpress.com.au/token
" //grant_type=client_credentials&client_id=ec24ff28.880f.4dfd.8c70.03c7ba8a6030&client_secret=vC/I+KA7dbTkiEN703sk6qy20qHScQ35 "
tempstring is string = "grant_type=client_credentials&client_id=ec24ff28.880f.4dfd.8c70.03c7ba8a6030&client_secret=vC/I+KA7dbTkiEN703sk6qy20qHScQ35"
myrequest..Content = NoSpace(tempstring)
myresponse is httpResponse
myresponse = HTTPSend(myrequest)
RESULT True
I am doing something wrong it keeps returning an error
any help would be great
Denunciar
0
0
Andrea Chiadò Piat
#2
Membro registado
54 mensagems
Popularité : +2 (2 votes)
Publicado em novembro, 06 2020 - 10:35 AM
Hello Kel,
for another type of service token request I use this code, you can do some try on it:
oRequest is a httpRequest
oResponse is a httpResponse
oRequest..URL = "
https://auth.someservice.somesite.it/auth/signin
"
oRequest..Method = httpPost
oRequest..User = ""
oRequest..Password = ""
// Type of Form
oRequest..ContentType = "application/x-www-form-urlencoded"
oRequest..Content = ""
// Form generation
HTTPCreateForm("FormData")
HTTPAddParameter("FormData", "grant_type", StringToUTF8("password"))
HTTPAddParameter("FormData", "username", StringToUTF8(YourUserName))
HTTPAddParameter("FormData", "password", StringToUTF8(YourPassword))
oRequest.IgnoreError=httpIgnoreInvalidCertificate
// Runs the request and retrieves the response
oResponse = HTTPSendForm("FormData", oRequest)
IF oResponse.StatusCode<>200 THEN
sMessErr="TokenError: "+oResponse..StatusCode+" - "+oResponse..DescriptionStatusCode+" - "+oResponse..Content+" - "+ErrorInfo()
ELSE
MyTokenAuth=JSONToVariant(oResponse..Content)
END
Hope this help
Bye
Andrea
Denunciar
2
0
Kel
#3
Publicado em novembro, 09 2020 - 12:10 AM
Works great thanks for the help
Denunciar
0
0
Mick
#4
Publicado em janeiro, 10 2021 - 1:20 PM
Hi Andrea Chiadò Piat:
Can the HTTPAddParameter pass array value?
Denunciar
0
0
→ Voltar para WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versões anteriores)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto