Send Authorized Request URL |
Sends a request (like posting a tweet), using the 2 credentials obtained during authorization.
Syntax
Send Authorized Request URL [ Select; Result ; Switches ; method ;
requestURL; accessToken ; accessTokenSecret ;
theRequest ]
Options
Select entire contents | replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field |
Result | the result of the request (or an error code) |
switches | determine the behavior of the function |
method | either POST or GET |
requestURL | URL of the web service to where the request must be sent |
accessToken | part 1 of the 2 credentials obtained during authorization |
accessTokenSecret | part 2 of the 2 credentials obtained during authorization |
theRequest | the request you want to perform |
Switches
switches must be set to:
-OAuthProtocol | the plug-in is using the OAuth protocol |
you can also use this switch:
-ReturnDataAfterError | return the error code followed by the data |
Returned Result
Data type returned
text
Result
If successful this script step returns the result of the request. If unsuccessful it returns an error code starting with $$ followed by the error code.
Originated in
Troi URL Plug-in 5.0
Compatibility
FileMaker Pro 16 to 19
Considerations
With this script step you can perform the actual work by sending requests to the web service, for example post a tweet on Twitter.
You need to have gotten credentials first with the two authorization functions TURL_GetAuthorizationURL and TURL_SendAuthorizationPIN (or Send Authorization PIN URL script step).
The plug-in currently only supports the OAuth 1.0A Authorization protocol.
Example
# This script will post a tweet on Twitter.
# Get the text to tweet in a variable:
Set Variable [ $TweetText ; this::TweetText ]
# Set up the other variables:
Set Variable [ $URL ; "http://api.twitter.com/1/statuses/update.json" ]
# Use the credentials stored in two global fields:
Set Variable [ $oauth_token ; this::gOAuth_token ]
Set Variable [ $oauth_token_secret ; this::gOAuth_token_secret ]
# Build the request to tweet (= a status update in the API):
# NOTE: the text of the tweet must be URL Encoded.
Set Variable [ $request ; "status=" & TURL_ToURLEncoded ( "-Unused" ; this::TweetText ) ]
#
# Now send the tweet to Twitter, using the POST method, and the oauth credentials.
Send Authorized Request URL [ Select ; $Result ; "-OAuthProtocol" ; "POST" ;
$URL ; $oauth_token ; $oauth_token_secret ; $request ]
Set Field [ this::Received text ; $Result ]
Related function
TURL_SendAuthorizedRequest |
Related topics
Troi URL Plug-in online help (overview)