Welcome! Log In Create A New Profile

Advanced

httprequest and xml

Posted by LasseS 
httprequest and xml
February 09, 2022 08:37AM
Hi again,

Two questions:

1: how to included json oauth2 token which in text format in httprequest ?

2: and which I include xml in this same sending ?

----
This is in my opinion right, and there comes token:
INTERNAL PROCEDURE MaventaAuth()
vContect.client_id = sClientID
vContect.client_secret = sClientPASS
vContect.vendor_api_key = sVendorAPI
vContect.grant_type = "client_credentials"
vContect.scope = "invoice:send"
bJsoncode = VariantToJSON( vContect )
hmaventa.Method = httpPost
hmaventa.URL = sURL + "oauth2/token"
hmaventa.ContentType = typeMimeJSON
hmaventa.Content = bJsoncode
rmaventa = RESTSend( hmaventa )
END

Now I'm trying to send file with this oauth token and this code
below does not work yet, what i'm missing??

INTERNAL PROCEDURE MaventaInvoiceSend( sToken is string )
// vContect.client_id = sClientID
// vContect.client_secret = sClientPASS
// vContect.vendor_api_key = sVendorAPI
vContect.scope = "eui"
vContect.AuthToken = sToken
vContect.file = "C:\erpKasoori\FinvoiceXML\20220208_1_Testiasiakas_Finvoice.xml"
vContect.format = "FINVOICE30"
vContect.recipient_type = "b2b"
bJsoncode = VariantToJSON( vContect )
hmaventa.Method = httpPost
hmaventa.URL = sURL + "v1/invoices"
hmaventa.ContentType = typeMimeJSON
hmaventa.Content = bJsoncode
rmaventa = RESTSend( hmaventa )
END

-----

best regards,
Lasse Sandström
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: