FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WINDEV 2024
→
httpsend
httpsend
Iniciado por kel, 05,nov. 2020 22:01 - 3 respuestas
Conéctese…
kel
#1
Publicado el 05,noviembre 2020 - 22:01
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
Informar
0
0
Andrea Chiadò Piat
#2
Miembro registrado
54 mensajes
Popularité : +2 (2 votes)
Publicado el 06,noviembre 2020 - 10:35
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
Informar
2
0
Kel
#3
Publicado el 09,noviembre 2020 - 00:10
Works great thanks for the help
Informar
0
0
Mick
#4
Publicado el 10,enero 2021 - 13:20
Hi Andrea Chiadò Piat:
Can the HTTPAddParameter pass array value?
Informar
0
0
→ Volver a WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versiones precedentes)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto