Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

PowerBuilder Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(PowerBuilder) Facebook User Feed (Read Posts)

Demonstrates how to read the feed of posts (including status updates) and links published by this person, or by others on this person's profile. This introductory example gets the first few posts.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Oauth2
oleobject loo_Rest
integer li_Success
string ls_ResponseJson
oleobject loo_Json
oleobject loo_Dtime
integer li_BLocalTime
oleobject loo_Dt
integer i
integer li_NumItems
string ls_Message
string ls_Story
string ls_PrevUrl
string ls_NextUrl

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

// This example assumes a previously obtained an access token
loo_Oauth2 = create oleobject
li_rc = loo_Oauth2.ConnectToNewObject("Chilkat_9_5_0.OAuth2")
if li_rc < 0 then
    destroy loo_Oauth2
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_Oauth2.AccessToken = "FACEBOOK-ACCESS-TOKEN"

loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")

// Connect to Facebook and send the following GET request:
li_Success = loo_Rest.Connect("graph.facebook.com",443,1,1)
if li_Success <> 1 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Oauth2
    destroy loo_Rest
    return
end if

// Provide the authentication credentials (i.e. the access key)
loo_Rest.SetAuthOAuth2(loo_Oauth2)

// We could limit the number of posts.  The default limit is 25.
loo_Rest.AddQueryParam("limit","5")

ls_ResponseJson = loo_Rest.FullRequestNoBody("GET","/v2.7/me/feed")
if loo_Rest.LastMethodSuccess <> 1 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Oauth2
    destroy loo_Rest
    return
end if

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_Json.EmitCompact = 0
loo_Json.Load(ls_ResponseJson)

// Show the JSON in human-readable format.
Write-Debug loo_Json.Emit()

// A sample JSON response is shown below.  
// This is the code to parse the JSON response.

loo_Dtime = create oleobject
li_rc = loo_Dtime.ConnectToNewObject("Chilkat_9_5_0.CkDateTime")

li_BLocalTime = 1

i = 0
li_NumItems = loo_Json.SizeOfArray("data")
do while i < li_NumItems
    loo_Json.I = i
    Write-Debug "--- " + string(i)
    ls_Message = loo_Json.StringOf("data[i].message")
    if loo_Json.LastMethodSuccess = 1 then
        Write-Debug "message: " + ls_Message
    end if

    ls_Story = loo_Json.StringOf("data[i].story")
    if loo_Json.LastMethodSuccess = 1 then
        Write-Debug "story: " + ls_Story
    end if

    Write-Debug "id: " + loo_Json.StringOf("data[i].id")

    // We can load the created_time into a CkDateTime...
    loo_Dtime.SetFromTimestamp(loo_Json.StringOf("data[i].created_time"))
    loo_Dt = loo_Dtime.GetDtObj(li_BLocalTime)
    Write-Debug string(loo_Dt.Month) + "/" + string(loo_Dt.Day) + "/" + string(loo_Dt.Year) + "  " + string(loo_Dt.Hour) + ":" + string(loo_Dt.Minute)
    destroy loo_Dt
    i = i + 1
loop

// Finally, there are two paging URLs at the very bottom.  Those can be accessed as shown:
ls_PrevUrl = loo_Json.StringOf("paging.previous")
Write-Debug "URL for previous page: " + ls_PrevUrl

ls_NextUrl = loo_Json.StringOf("paging.next")
Write-Debug "URL for next page: " + ls_NextUrl

// -------------------------------------------------------------------
// This is a sample JSON response..
// { 
//   "data": [
//     { 
//       "message": "This is the first post.",
//       "created_time": "2016-09-28T14:36:45+0000",
//       "id": "12345678901234567_12345678900000001"
//     },
//     { 
//       "message": "This is the 2nd post.",
//       "created_time": "2016-09-27T03:26:12+0000",
//       "id": "12345678901234567_12345678900000002"
//     },
//     { 
//       "story": "John Doe shared Mary's post.",
//       "created_time": "2016-09-26T15:45:10+0000",
//       "id": "12345678901234567_12345678900000003"
//     },
//     { 
//       "message": "https:\/\/www.somewebsite.org\/?ID=8158",
//       "created_time": "2016-09-26T02:29:20+0000",
//       "id": "12345678901234567_12345678900000004"
//     },
//     { 
//       "message": "http:\/\/blog.somebody.com\/post\/123",
//       "created_time": "2016-09-26T02:02:56+0000",
//       "id": "12345678901234567_12345678900000005"
//     },
//     { 
//       "story": "John Doe shared Bill's photo.",
//       "created_time": "2016-09-25T15:32:09+0000",
//       "id": "12345678901234567_12345678900000006"
//     },
//     { 
//       "message": "Check this out...",
//       "story": "John Doe shared NPR Music's video.",
//       "created_time": "2016-09-25T14:54:52+0000",
//       "id": "12345678901234567_12345678900000007"
//     },
//     { 
//       "message": "Yet another post...",
//       "created_time": "2016-09-24T17:21:30+0000",
//       "id": "12345678901234567_12345678900000008"
//     },
//     { 
//       "message": "http:\/\/www.somewhere.com\/blahblahblah\/",
//       "created_time": "2016-09-23T22:20:29+0000",
//       "id": "12345678901234567_12345678900000009"
//     },
//     { 
//       "message": "At Lincoln marsh ...",
//       "story": "John Doe added 2 new photos.",
//       "created_time": "2016-09-19T02:00:43+0000",
//       "id": "12345678901234567_12345678900000010"
//     },
//     { 
//       "message": "I would've went for a swim had it not been for the sign",
//       "created_time": "2016-09-19T01:59:47+0000",
//       "id": "12345678901234567_12345678900000011"
//     },
//     { 
//       "story": "John Doe shared Steve's video.",
//       "created_time": "2016-09-17T22:00:02+0000",
//       "id": "12345678901234567_12345678900000012"
//     },
//     { 
//       "message": "Another sample message...",
//       "story": "John Doe shared XYZ's post.",
//       "created_time": "2016-09-17T14:13:16+0000",
//       "id": "12345678901234567_12345678900000013"
//     },
//     { 
//       "message": "Hello World!",
//       "created_time": "2016-09-16T23:17:13+0000",
//       "id": "12345678901234567_12345678900000014"
//     },
//     { 
//       "message": "https:\/\/www.youtube.com\/watch?v=xyz",
//       "created_time": "2016-09-15T04:13:02+0000",
//       "id": "12345678901234567_12345678900000015"
//     },
//     { 
//       "story": "John Doe shared Emily's photo.",
//       "created_time": "2016-09-14T16:37:10+0000",
//       "id": "12345678901234567_12345678900000016"
//     },
//     { 
//       "story": "John Doe shared Vincent's photo.",
//       "created_time": "2016-09-14T14:03:42+0000",
//       "id": "12345678901234567_12345678900000017"
//     },
//     { 
//       "message": "https:\/\/www.chilkatsoft.com\/",
//       "created_time": "2016-09-14T02:29:37+0000",
//       "id": "12345678901234567_12345678900000018"
//     },
//     { 
//       "message": "So cool!  Marcus jamming with this 16 year old kid...",
//       "created_time": "2016-09-13T17:04:53+0000",
//       "id": "12345678901234567_12345678900000019"
//     },
//     { 
//       "message": "Wow!",
//       "story": "John Doe shared Somebody's post.",
//       "created_time": "2016-09-13T14:11:18+0000",
//       "id": "12345678901234567_12345678900000020"
//     }
//   ],
//   "paging": { 
//     "previous": "https:\/\/graph.facebook.com\/v2.7\/12345678901234567\/feed?since=1475073405&limit=25&__paging_token=enc_abcT9x9GFabcTxvnyXZC0xnHZCrH2h4yjNZCZAUabcZAI9TyZBibwat6wCYiSFTxR4nSDZAkzaN8vIaEPmqrabc1QTIbGac&__previous=1",
//     "next": "https:\/\/graph.facebook.com\/v2.7\/12345678901234567\/feed?limit=25&until=1473426350&__paging_token=enc_AdDFWabcYtV5ob6lFO8LZAMhm7LKCxntawqqabcZALyC8WZB8Th2lON7HGuJRabzW6Ivfm93LORIw9NNBuHpob7abcjh"
//   }
// }
// 


destroy loo_Oauth2
destroy loo_Rest
destroy loo_Json
destroy loo_Dtime

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.