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