1. mukul pandey
  2. PowerBuilder
  3. Wednesday, 13 April 2022 09:56 AM UTC

Hi Gurus,

 

I am using PowerBuilder 2019 R2 classic. I am not aware with Rest API calling in PowerBuilder .

Below is the example of HTTP request.:-

 

Request URL: https://api.incontact.com/InContactAuthorizationServer/Token
Request Method: POST
Request Headers:
        POST /InContactAuthorizationServer/Token HTTP/1.1
Host: api.incontact.com
Connection:  keep-alive
Content-Length: 65
Origin: http://myapp.example.com
Authorization: basic H6CwZTJfYaWKnZDeAV2lkZS5o2V7U0c4lgIy5jb2675B6+MTIzNDdfgd9786dg/0hdUfyhuDFHDA2=
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko)
            Chrome/23.0.1271.95 Safari/537.11
Content-Type: application/json; charset=UTF-8
Accept: application/json, text/javascript, */*; q=0.01
Referer: http://myapp.example.com/mainPage
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Request Payload:
{
   "grant_type" : "client_credentials", 
   "scope" : "PatronAPI"
}

Please help.
Accepted Answer
Marco Meoni Accepted Answer Pending Moderation
  1. Wednesday, 13 April 2022 13:54 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Mukul,

you can use the PB HTTPclient object.

See here: https://docs.appeon.com/pb2019r2/powerscript_reference/ch10s684.html

Examples 2 and 3 require small changes (1. adapt the JSON payload, 2. correct the URL, 3. set headers) to match your POST request.

Best,

.m

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Friday, 15 April 2022 17:33 PM UTC
  2. PowerBuilder
  3. # 1

The client credentials grant is much more difficult to do in PB as opposed to a web app.  I'd recommend using the password grant.  If they allow you to create a service account with a password, us that and then the password grant is fairly easy to use.  If you can't figure it out, I do freelance work, you can contact me on Linked In.

 

Kevin

Comment
There are no comments made yet.
mukul pandey Accepted Answer Pending Moderation
  1. Wednesday, 11 May 2022 07:29 AM UTC
  2. PowerBuilder
  3. # 2

Thanks to all of you. API is working fine with HTTPclient object.

Attachments (1)
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.