1. Winthor Caingles
  2. PowerBuilder
  3. Friday, 3 February 2023 07:53 AM UTC

 

HI APPEON Support,

 

Good day... I need your help badly... I am new in API and REST... need guidance. Our company is implementing SMS Blast..

 

Authentication is give by the provider company.

 

  1. Basic Authentication in the HTTP header
    Authorization: Basic {base64-encoded username:password}.

  2. Add username and password within the Connect API request as parameters.

  3. Provide JWT within Authorization Bearer HTTP header after authorization at:

    https://messagingsuite.smart.com.ph/cgpapi/login/auth

    1. Refresh or provide new token every 30 minutes.

    2. Auth payload is {“username”;”usr”,”password”:”pwd”}.

i. accessToken from response to provide JWT inside Bearer header.

 

 

Set the HTTP header to Content-Type:application/json;charset=UTF-8

 

 

Please help... I have no idea on this... I follow the example from the ELEVATE VIDEO but it is not working... I don't know where to start...

thanks for the help...

Accepted Answer
Daryl Foster Accepted Answer Pending Moderation
  1. Monday, 6 February 2023 23:58 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Winthor, I saw your earlier post so you may have sorted this out already, but one obvious error is that the json you are sending is not valid, it has a semi-colon after username, which should be a colon:

{"username";"test@gmail.com","password":"12345"}

Should be

{"username":"test@gmail.com","password":"12345"}
Comment
  1. Winthor Caingles
  2. Tuesday, 7 February 2023 05:12 AM UTC
Hi Daryl, I just used the basic authentication to get the token... and it works... the problem now is how to use the token to POST...
  1. Helpful
  1. Daryl Foster
  2. Tuesday, 7 February 2023 06:12 AM UTC
No worries, did you try my suggestion in your other post about using Basic auth with the username and token? Or using Postman to troubleshoot?
  1. Helpful
There are no comments made yet.
Winthor Caingles Accepted Answer Pending Moderation
  1. Monday, 6 February 2023 01:08 AM UTC
  2. PowerBuilder
  3. # 1

thank you Migs,

 

this is the code I write...

 

String ls_P028_JWTToken
Integer li_P028_GetJWTTokenReturn
RestClient lrc_P028
lrc_P028 = Create RestClient

lrc_P028.SetRequestHeaders( "Content-Type:application/json;charset=UTF-8" ) //Sets the request header
//Gets the JWT token. The second parameter provides the value according to the token server request.
li_P028_GetJWTTokenReturn=lrc_P028.GetJWTToken("https://messagingsuite.smart.com.ph/cgpapi/login/auth", '{"username";"test@gmail.com","password":"12345"}', ls_P028_JWTToken)

If li_P028_GetJWTTokenReturn = 1 Then
//Sets the JWT token
lrc_P028.SetJwtToken( ls_P028_JWTToken)
//Retrieves data for dw_Data
mle_1.text = ls_P028_JWTToken
Else
//Prints the GetJWTToken error message if any
End If

 

error occurred and
this is the return value:
{
"statusCode" : 404,
"statusText" : "Not Found",
"errorCode" : 404100,
"errorType" : "CLIENT_ERROR",
"errorDescription" : "HTTP 404 Not Found"
}

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.