Xbase++ Requires Chilkat v11.0.0+
Xbase++
NetSuite OAuth1
See more OAuth1 Examples
Demonstrates adding OAUth1 authentication to a NetSuite REST API request.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL oResp
nSuccess := 0
// It requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.Http")
oHttp:OAuth1 := 1
oHttp:OAuthConsumerKey := "CONSUMER_KEY"
oHttp:OAuthConsumerSecret := "CONSUMER_SECRET"
oHttp:OAuthToken := "ACCESS_TOKEN"
oHttp:OAuthTokenSecret := "TOKEN_SECRET"
oHttp:OAuthRealm := "ACCOUNT_ID"
oHttp:OAuthSigMethod := "HMAC-SHA256"
// Not sure if this is needed for NetSuite requests.
oHttp:SetRequestHeader("Cookie", "NS_ROUTING_VERSION=LAGGING")
// Replace ACCOUNT_ID with your actual account id, which is likely a 7-digit decimal number.
oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpNoBody("GET", "https://ACCOUNT_ID.suitetalk.api.netsuite.com/services/rest/record/v1/salesOrder", oResp)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oResp:destroy()
RETURN
ENDIF
? "Response Status Code: " + Str(oResp:StatusCode)
? "Response Body:"
? oResp:BodyStr
oHttp:destroy()
oResp:destroy()