ERROR!
------------------- GenerateCode ----------------------
ImpliedContentType: application/x-www-form-urlencoded
---- begin chilkat script ----
// This example assumes the Chilkat API to have been previously unlocked.
// See {{-global_unlock:::Global Unlock Sample-}} for sample code.
new Http http;
ckbool success;
new HttpRequest req;
call req.AddParam("client_id","cc446489-7217-4791-a4d2-b7d14a36b8a5");
call req.AddParam("client_secret","a7d0addf-86d4-4d7a-bd44-623f8dda9108");
call req.AddParam("grant_type","client_credentials");
call req.AddParam("scope","InvoicingAPI");
call req.AddHeader("client_id","{{clientId}}");
call req.AddHeader("grant_type","client_credentials");
call req.AddHeader("client_secret","{{clientSecret}}");
new HttpResponse resp;
req.HttpVerb = "POST";
req.ContentType = "application/x-www-form-urlencoded";
success = http.PostUrlEncoded("https://domain.com/connect/token", req,resp);
if (success == ckfalse) {
println http.LastErrorText;
return;
}
println resp.StatusCode;
println resp.BodyStr;
---- end chilkat script ----
PowerBuilder / LHDN MyInvois SDK / Login as Taxpayer System
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Req
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Req = create oleobject
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
loo_Req.AddParam("client_id","cc446489-7217-4791-a4d2-b7d14a36b8a5")
loo_Req.AddParam("client_secret","a7d0addf-86d4-4d7a-bd44-623f8dda9108")
loo_Req.AddParam("grant_type","client_credentials")
loo_Req.AddParam("scope","InvoicingAPI")
loo_Req.AddHeader("client_id","{{clientId}}")
loo_Req.AddHeader("grant_type","client_credentials")
loo_Req.AddHeader("client_secret","{{clientSecret}}")
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")
loo_Req.HttpVerb = "POST"
loo_Req.ContentType = "application/x-www-form-urlencoded"
ERROR: Assignment type mismatch. ExpressionType=HttpResponse, atgType=ckbool
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Req
destroy loo_Resp
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Http
destroy loo_Req
destroy loo_Resp
Curl Command
curl -X POST
-H "client_id: {{clientId}}"
-H "client_secret: {{clientSecret}}"
-H "grant_type: client_credentials"
--data-urlencode 'client_id=cc446489-7217-4791-a4d2-b7d14a36b8a5'
--data-urlencode 'client_secret=a7d0addf-86d4-4d7a-bd44-623f8dda9108'
--data-urlencode 'grant_type=client_credentials'
--data-urlencode 'scope=InvoicingAPI'
https://domain.com/connect/token
Postman Collection Item JSON
{
"name": "Login as Taxpayer System",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"connection": true,
"accept-encoding": true,
"accept": true,
"user-agent": true,
"host": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "client_id",
"value": "{{clientId}}",
"type": "text",
"uuid": "ee303c9d-1311-4e81-95ac-d9479dd2b5c0",
"disabled": true
},
{
"key": "client_secret",
"value": "{{clientSecret}}",
"type": "text",
"uuid": "091d3a0c-149b-47c1-ae6a-efd5cac1f983",
"disabled": true
},
{
"key": "grant_type",
"value": "client_credentials",
"type": "text",
"uuid": "4c8439d5-eff6-4d7f-a66c-5d8d3f1a0938",
"disabled": true
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "client_id",
"value": "cc446489-7217-4791-a4d2-b7d14a36b8a5",
"type": "text"
},
{
"key": "client_secret",
"value": "a7d0addf-86d4-4d7a-bd44-623f8dda9108",
"type": "text"
},
{
"key": "grant_type",
"value": "client_credentials",
"type": "text"
},
{
"key": "scope",
"value": "InvoicingAPI",
"type": "text"
}
]
},
"url": {
"raw": "{{idSrvBaseUrl}}/connect/token",
"host": [
"{{idSrvBaseUrl}}"
],
"path": [
"connect",
"token"
]
}
},
"response": [
]
}