Adapter Online Help > TDV Twitter Adapter > Data Model > Stored Procedures
 
Stored Procedures
Stored procedures are available to complement the data available from the Data Model. It may be necessary to update data available from a view using a stored procedure because the data does not provide for direct, table-like, two-way updates. In these situations, the retrieval of the data is done using the appropriate view or table, while the update is done by calling a stored procedure. Stored procedures take a list of parameters and return back a dataset that contains the collection of tuples that constitute the response.
Twitter Adapter Stored Procedures
Name
Description
Run a geo-search against the Twitter service.
Obtains the OAuth access token to be used for authentication with Twitter. If using a Windows application, set AuthMode to APP. If using a Web App, set AuthMode to WEB and specify the AuthToken, AuthKey, and Verifier returned by GetOAuthAuthorizationUrl.
Gets the authorization URL, AuthToken, and AuthKey from Twitter. Navigate to the authorization URL in an Internet browser. This will return a verifier token that you will need to use as input along with the AuthToken for the GetOAuthAccessToken stored procedure.
Returns the number of remaining requests that can be made to Twitter and how long until the request limit is reset.
Reverse-searches a place based on the specified latitude and longitude.
Uploads an image or video.
GeoSearch
Run a geo-search against the Twitter service.
Input
Name
Type
Description
Latitude
String
The latitude to search around. This parameter will be ignored unless it is inside the range -90.0 to 90.0 inclusive. (North is positive.) It will also be ignored if there is not a corresponding Longitude input.
Longitude
String
The longitude to search around. The valid ranges for longitude are -180.0 to 180.0 inclusive. (East is positive). This parameter will be ignored if it is outside that range, if it is not a number, if Geo_Enabled is disabled, or if there not a corresponding Latitude input.
IP
String
An IP address. Used when attempting to fix geo-location based off of the user.
Accuracy
String
A hint on the region in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If this is not passed in, then it is assumed to be 0m.
ContainedWithin
String
The place Id that you would like to restrict the search results to. Setting this value means only places within the given place Id will be found.
Granularity
String
The minimal granularity of place types to return. Valid values are poi, neighborhood, city, admin, or country. If no granularity is provided for the request, neighborhood is assumed. Setting this to city, for example, will find places that have a type of city, admin, or country.
MaxResults
String
A hint as to the number of results to return. This does not guarantee that the number of results returned will equal MaxResults, but instead informs how many nearby results to return.
Query
String
Free-form text to match against while executing a geo-based query. This parameter is best suited for finding nearby locations by name. Note that the query must be URL encoded.
Result Set Columns
Name
Type
Description
Id
String
The place Id.
Name
String
Name of the place.
Country
String
The country name where the coordinates are located.
CountryCode
String
The code for the country.
FullName
String
Full name of the place.
Latitude
String
The latitude of the place.
Longitude
String
The longitude of the place.
PlaceType
String
The type of place (city, neighborhood, etc.)
GetOAuthAccessToken
Obtains the OAuth access token to be used for authentication with Twitter. If using a Windows application, set AuthMode to APP. If using a Web App, set AuthMode to WEB and specify the AuthToken, AuthKey, and Verifier returned by GetOAuthAuthorizationUrl.
Input
Name
Type
Description
AuthMode
String
Enter either APP or WEB. The type of authentication mode to use. Set to APP to get authentication tokens via a Windows app (.exe). Set to WEB to get authentication tokens via a Web app.
The default value is APP.
AuthToken
String
The authentication token returned by GetOAuthAuthorizationUrl. Required for only the Web AuthMode.
AuthKey
String
The AuthKey returned by GetOAuthAuthorizationUrl. Required for only the Web AuthMode.
Verifier
String
The verifier token returned by Twitter after using the URL obtained with GetOAuthAuthorizationURL. Required for only the Web AuthMode.
State
String
Any value that you wish to be sent with the callback.
Result Set Columns
Name
Type
Description
OAuthAccessToken
String
The OAuth access token.
OAuthAccessTokenSecret
String
The OAuth access token secret.
ExpiresIn
String
The remaining lifetime on the access token. A -1 denotes that it will not expire.
GetOAuthAuthorizationURL
Gets the authorization URL, AuthToken, and AuthKey from Twitter. Navigate to the authorization URL in an Internet browser. This will return a verifier token that you will need to use as input along with the AuthToken for the GetOAuthAccessToken stored procedure.
Input
Name
Type
Description
CallbackURL
String
The URL that Twitter will return to after the user has authorized your app.
State
String
Any value that you wish to be sent with the callback.
Result Set Columns
Name
Type
Description
URL
String
The URL to be entered into a Web browser to obtain the verifier token and authorize your Twitter app with.
AuthToken
String
A token used as input for the GetOAuthAccessToken stored procedure to verify the request and obtain the OAuth access token.
AuthKey
String
A key used as input for the GetOAuthAccessToken stored procedure to verify the request and obtain the OAuth access token.
GetRemainingRequests
Returns the number of remaining requests that can be made to Twitter and how long until the request limit is reset.
Input
Name
Type
Description
Resources
String
A comma-separated list of the resources you want to request rate limit information about. For example: search,users,statuses
Result Set Columns
Name
Type
Description
Remaining_Requests
String
The number of remaining API requests.
Reset_Time
String
When your available API requests will reset.
Reset_Time_Seconds
String
The time in seconds since 1/1/1970 when your remaining API requests will be reset.
Limit
String
Your limit of total API requests per window. At the moment, each window is 15 minutes.
Api_Request
String
The API request the rate limit information returned goes with.
ReverseGeoSearch
Reverse-searches a place based on the specified latitude and longitude.
Input
Name
Type
Description
Accuracy
String
A hint on the region in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If this is not passed in, then it is assumed to be 0m.
Granularity
String
This is the minimal granularity of place types to return. Valid values are poi, neighborhood, city, admin, or country. If no granularity is provided for the request, neighborhood is assumed. Setting this to city, for example, will find places that have a type of city, admin, or country.
Latitude
String
The latitude to search around. This parameter will be ignored unless it is inside the range -90.0 to 90.0 inclusive. (North is positive.) It will also be ignored if there is not a corresponding Longitude input.
Longitude
String
The longitude to search around. The valid ranges for longitude are -180.0 to 180.0 inclusive. (East is positive.) This parameter will be ignored if it is outside that range, if it is not a number, if Geo_Enabled is disabled, or if there not a corresponding Latitude input.
MaxResults
String
A hint as to the number of results to return. This does not guarantee that the number of results returned will equal MaxResults, but instead informs how many nearby results to return.
Result Set Columns
Name
Type
Description
Id
String
The place Id.
Name
String
Name of the place.
Country
String
The country name where the coordinates are located.
CountryCode
String
The code of the country.
FullName
String
Full name of the place.
Latitude
String
The latitude of the place.
Longitude
String
The longitude of the place.
PlaceType
String
The type of place (i.e., city, neighborhood, etc.)
UploadMedia
Uploads an image or video.
Stored Procedure Specific Info
Upload Media
Use this procedure to upload images or videos to Twitter. It returns media Ids, which can be used to create a Tweet with an attached photo or video. The uploaded media expires in 24 hours after the upload. The video size should not be more then 15 MB and 30 seconds of the length.
Set MediaFilePath#INDEX for every media file. For example, the set of media files to upload would be the following:
MediaFilePath#1 - path/to/file1
 
MediaFilePath#2 - path/to/file2
The result of the procedure is a list of media Ids, which can be retrieved by MediaId#INDEX for every media file uploaded.
Input
Name
Type
Description
MediaFilePath#
String
Media file path to associate with the Tweet. You can include up to 4 photos or 1 animated GIF or 1 video in a Tweet.
Result Set Columns
Name
Type
Description
MediaId#
String
The Ids of the media uploaded.