FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WINDEV 2024
→
json problem
json problem
Iniciado por Lasse Sandström, 14,ago. 2022 07:59 - 3 respuestas
Conéctese…
Lasse Sandström
#1
Miembro registrado
19 mensajes
Publicado el 14,agosto 2022 - 07:59
Hi,
there is how to I get token form maventa in Finland:
INTERNAL PROCEDURE MaventaAuth()
sJson.client_id = sClientID
sJson.client_secret = sClientPASS
sJson.vendor_api_key = sVendorAPI
sJson.grant_type = "client_credentials"
sJson.scope = "eui"
sRestReq.Method = httpPost
sRestReq.URL = sURL + "oauth2/token"
sRestReq.ContentType = typeMimeJSON
sRestReq.Content = sJson
sRestRes = RESTSend( sRestReq )
END
And there comes this:
{"access_token":"eyJ0eXAiOiJKV1QiLCJraWQiOiIyZGZjYTlmMTE4ZWRlNThmYmZiMjM0ZTIxZDQ0MTY1ODVjNzc3NjZjMDY4OTk4MDdkYTgwNTlhMTRmODRlNjgyIiwiYWxnIjoiUlM1MTIifQ.eyJpZGVudGl0eSI6InVzZXIiLCJ1c2VyX2lkIjoiMTEyYTUzM2YtYjgzNS00ZTQzLTgzMjYtNzNjOWY3ODhjYzkyIiwiY29tcGFueV9pZCI6Ijg3NzI3MzUyLWU3MjEtNGRlNi1iYzY4LWI2YmI5YWQwZTA1ZiIsInNjb3BlIjpbImV1aTpvcGVuIiwiY29tcGFueTpyZWFkIiwiY29tcGFueTp3cml0ZSIsImxvb2t1cCIsInJlY2VpdmFibGVzOmFzc2lnbm1lbnRzIiwiZG9jdW1lbnQ6c2VuZCIsImRvY3VtZW50OnJlY2VpdmUiLCJpbnZvaWNlOnJlY2VpdmUiLCJpbnZvaWNlOnNlbmQiLCJhbmFseXNpcyJdLCJ2ZW5kb3JfaWQiOiJkMjlhZDgwYy0zYzM3LTRkNjAtOTc3MS0wYzkxZDdjYWZmNzIiLCJleHAiOjE2NjA0NTk3NTB9.DQAYSYsAAFHnkZvbRBm35yEhf02idTnBKjqc4Ldg9vhfNHE4DoGXp4bz6Qf4JlSkCja40HANz5wkRDgNsT_uINkek3-MIRa5HRcs256Rc-lWa9oy1vKsZFtyYMbUkF_vCqUd0t8v_conrNHJwnw6hoDS-vp3vd43dm-vRUXko6optu4amGNXnbJ_CD3rfdAJHFYFeHX8GaURdBUKUAglXZlHRiqk9zbyc0xbvIZNgqgvlKt-g7vTZkn-0P8QwMYpPNLKn5ic1KREwfM77p1wy902qNfYrXV2KgvXQfJxXJ4zjT5MXZf_XGnUP3H-cki870HMx_yi_B0aqBdDlINRbw","token_type":"bearer","expires_in":3600,"scope":"eui"}
This is right, but how I put this in next:
INTERNAL PROCEDURE MaventaInvoiceSend()
sRestReq.Header[ "file" ] = fLoadText( "C:\erpKasoori\FinvoiceXML\20220208_1_Testiasiakas_Finvoice.xml" )
sRestReq.Header[ "format" ] = "--" // "FINVOICE30"
sRestReq.Header[ "recipient_type" ] = "b2b"
sRestReq.Header[ "recipient_operator" ] = "003721291126"
sRestReq.Header[ "disabled-routes" ] = "--"
sRestReq.Header[ "route_order" ] = "--"
sRestReq.Method = httpPost
sRestReq.URL = sURL + "v1/invoices"
sRestReq.AuthToken = sAuth
sRestReq.ContentType = typeMimeJSON
sRestRes = RESTSend( sRestReq )
END
this token is in sAuth variable, and does not work, what is way to put this token to
sRestReq.AuthToken = sAuth
br Lasse S
Informar
0
0
Lasse Sandström
#2
Miembro registrado
19 mensajes
Publicado el 25,agosto 2022 - 07:43
Need some help for this!
Informar
0
0
Rubén Sánchez Peña
#3
Miembro registrado
797 mensajes
Popularité : +40 (42 votes)
Publicado el 25,agosto 2022 - 20:18
Hi. According to the help (
https://doc.windev.com/en-US/…
), the parameter in which you pass the token is called "access_token" by default. Is that the name the API expects? If it is not correct you should define the parameter yourself.
Rubén
Informar
0
0
Richard
#4
Miembro registrado
58 mensajes
Popularité : +6 (6 votes)
Publicado el 26,agosto 2022 - 10:06
Hi Lasse,
I think your request need the token like that :
s
RestReq.Header
[
"access_token"
] =
"bearer ###ALL THE CONTENT OF ACCESS_TOKEN###"
Many API use this syntax.
--
Qui ne sait rien, de rien ne doute...
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