Adapter Online Help > TDV Facebook 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.
Facebook Adapter Stored Procedures
Name
Description
Creates a schema file for an app insight.
Creates a schema file for an insight.
Gets an authentication token from Facebook.
Gets an AuthURL from Facebook. You will request the auth token from this URL.
Refreshes the OAuth token.
Post a photo to a user, page, album or event.
Post a video to a user, page, group or event.
CreateAppInsightSchema
Creates a schema file for an app insight.
Input
Name
Type
Description
InsightName
String
The name of the insight to create a table for.
The allowed values are API_AVG_REQUEST_TIME, API_CALLS, API_CALLS_BY_METHOD, API_ERROR_RATE_BY_METHOD, API_ERRORS, API_ERRORS_BY_METHOD, APP_BLOCKS, APP_CENTER_INITIAL_PERMISSION_GRANTS, APP_CENTER_INITIAL_PERMISSION_REQUESTS, APP_EVENT, APP_NOTIFICATION_CLICKS, APP_NOTIFICATION_HIDE_RATE, APP_NOTIFICATION_HIDES, APP_NOTIFICATION_IMPLICIT_ACCEPTS, APP_NOTIFICATION_IMPRESSIONS, APP_NOTIFICATION_REJECTS, APP_NOTIFICATION_SENDS, APP_NOTIFICATION_SPAM_RATE, APP_NOTIFICATION_SPAM_REPORTS, APP_NOTIFICATION_TOTAL_ACCEPTS, APP_NOTIFICATION_UNHIDES, FACEBOOK_FEATURES_DAILY_ACTIVE_USERS, FACEBOOK_FEATURES_MONTHLY_ACTIVE_USERS, FACEBOOK_FEATURES_WEEKLY_ACTIVE_USERS, FACEBOOK_LOGIN_TOTAL_USERS, GAMER_GROUP_JOINS, GAMER_GROUP_LEAVES, GAMER_GROUP_POST_COMMENTS, GAMER_GROUP_POST_LIKES, GAMER_GROUP_POSTS, GAMER_GROUP_SESSION_START_GUESTS, GAMER_GROUP_SESSION_START_MEMBERS, GAMER_GROUP_VISITS, INITIAL_PERMISSION_GRANTS, LOGIN_DIALOG_ADDITIONAL_PERMISSION_GRANTS, LOGIN_DIALOG_ADDITIONAL_PERMISSION_REQUESTS, LOGIN_DIALOG_INITIAL_PERMISSION_GRANTS, LOGIN_DIALOG_INITIAL_PERMISSION_REQUESTS, LOGIN_DIALOG_PUBLISH_PERMISSION_GRANTS, LOGIN_DIALOG_PUBLISH_PERMISSION_REQUESTS, MOBILE_REFERRAL_INSTALLS, MOBILE_REFERRALS, PAYMENTS_DAILY_CHARGEBACKS, PAYMENTS_DAILY_REFUNDS, (cont’d)
InsightName
String
PAYMENTS_DAILY_SPEND, PERMISSION_REVOCATIONS, REQUEST_ACCEPTS, REQUEST_BLOCKS, REQUEST_IMPRESSIONS, REQUEST_SENDS, REQUEST_SPAM_RATE, STORY_CLICKS, STORY_COMMENTS, STORY_IMPRESSIONS, STORY_LIKES, STORY_PUBLISHES, STORY_SPAM_RATE, STRUCTURED_REQUEST_ACCEPTS, STRUCTURED_REQUEST_IMPRESSIONS, STRUCTURED_REQUEST_SENDS, TOTAL_REFERRALS.
Target
String
The default target for this app insight. Use 'app' to indicate the current Facebook App.
The default value is app.
FromDateTime
String
The earliest date and time value for which to return insight data. This will override the Periods input and in some insights is required.
ToDateTime
String
The latest date and time value for which to return insight data. This will override the Periods input and in some insights is required.
Description
String
An optional description for the insight. This will override the description that comes from the data source.
Result Set Columns
Name
Type
Description
Result
String
Returns Success or Failure.
SchemaFile
String
The generated schema file. You will need to set the Location property to the folder containing your schema files.
Columns
String
The number of columns found.
CreateInsightSchema
Creates a schema file for an insight.
Input
Name
Type
Description
InsightName
String
The name of the insight to create a table for.
The allowed values are PAGE_CONSUMPTIONS, (cont’d)
InsightName
String
PAGE_CONSUMPTIONS_BY_CONSUMPTION_TYPE, PAGE_CONSUMPTIONS_BY_CONSUMPTION_TYPE_UNIQUE, PAGE_CONSUMPTIONS_UNIQUE, PAGE_ENGAGED_USERS, PAGE_FAN_ADDS, PAGE_FAN_ADDS_UNIQUE, PAGE_FAN_REMOVES, PAGE_FAN_REMOVES_UNIQUE, PAGE_FANS, PAGE_FANS_BY_LIKE_SOURCE, PAGE_FANS_BY_LIKE_SOURCE_UNIQUE, PAGE_FANS_BY_UNLIKE_SOURCE_UNIQUE, PAGE_FANS_CITY, PAGE_FANS_COUNTRY, PAGE_FANS_GENDER_AGE, PAGE_FANS_LOCALE, PAGE_FANS_ONLINE, PAGE_FANS_ONLINE_PER_DAY, PAGE_IMPRESSIONS, PAGE_IMPRESSIONS_BY_AGE_GENDER_UNIQUE, PAGE_IMPRESSIONS_BY_CITY_UNIQUE, PAGE_IMPRESSIONS_BY_COUNTRY_UNIQUE, PAGE_IMPRESSIONS_BY_LOCALE_UNIQUE, PAGE_IMPRESSIONS_BY_STORY_TYPE, PAGE_IMPRESSIONS_BY_STORY_TYPE_UNIQUE, PAGE_IMPRESSIONS_FREQUENCY_DISTRIBUTION, PAGE_IMPRESSIONS_ORGANIC, PAGE_IMPRESSIONS_ORGANIC_UNIQUE, PAGE_IMPRESSIONS_PAID, PAGE_IMPRESSIONS_PAID_UNIQUE, PAGE_IMPRESSIONS_UNIQUE, PAGE_IMPRESSIONS_VIRAL, PAGE_IMPRESSIONS_VIRAL_FREQUENCY_DISTRIBUTION, PAGE_IMPRESSIONS_VIRAL_UNIQUE, PAGE_NEGATIVE_FEEDBACK, PAGE_NEGATIVE_FEEDBACK_BY_TYPE, PAGE_NEGATIVE_FEEDBACK_BY_TYPE_UNIQUE, PAGE_NEGATIVE_FEEDBACK_UNIQUE, PAGE_PLACES_CHECKIN_MOBILE, PAGE_PLACES_CHECKIN_MOBILE_UNIQUE, PAGE_PLACES_CHECKIN_TOTAL, PAGE_PLACES_CHECKIN_TOTAL_UNIQUE, PAGE_PLACES_CHECKINS_BY_AGE_GENDER,
InsightName
String
PAGE_PLACES_CHECKINS_BY_COUNTRY, PAGE_PLACES_CHECKINS_BY_LOCALE, PAGE_POSITIVE_FEEDBACK_BY_TYPE, PAGE_POSITIVE_FEEDBACK_BY_TYPE_UNIQUE, PAGE_POSTS_IMPRESSIONS, PAGE_POSTS_IMPRESSIONS_FREQUENCY_DISTRIBUTION, PAGE_POSTS_IMPRESSIONS_ORGANIC, PAGE_POSTS_IMPRESSIONS_ORGANIC_UNIQUE, PAGE_POSTS_IMPRESSIONS_PAID, PAGE_POSTS_IMPRESSIONS_PAID_UNIQUE, PAGE_POSTS_IMPRESSIONS_UNIQUE, PAGE_POSTS_IMPRESSIONS_VIRAL, PAGE_POSTS_IMPRESSIONS_VIRAL_UNIQUE, PAGE_STORIES, PAGE_STORIES_BY_STORY_TYPE, PAGE_STORYTELLERS, PAGE_CONTENT_ACTIVITY_BY_AGE_GENDER_UNIQUE, PAGE_CONTENT_ACTIVITY_BY_CITY_UNIQUE, PAGE_CONTENT_ACTIVITY_BY_COUNTRY_UNIQUE, PAGE_CONTENT_ACTIVITY_BY_LOCALE_UNIQUE, PAGE_STORYTELLERS_BY_STORY_TYPE, PAGE_TAB_VIEWS_LOGIN_TOP, PAGE_TAB_VIEWS_LOGIN_TOP_UNIQUE, PAGE_TAB_VIEWS_LOGOUT_TOP, PAGE_VIDEO_COMPLETE_VIEWS_30S, PAGE_VIDEO_COMPLETE_VIEWS_30S_AUTOPLAYED, PAGE_VIDEO_COMPLETE_VIEWS_30S_CLICK_TO_PLAY, PAGE_VIDEO_COMPLETE_VIEWS_30S_ORGANIC, PAGE_VIDEO_COMPLETE_VIEWS_30S_PAID, PAGE_VIDEO_COMPLETE_VIEWS_30S_REPEAT_VIEWS, PAGE_VIDEO_COMPLETE_VIEWS_30S_UNIQUE, PAGE_VIDEO_REPEAT_VIEWS, PAGE_VIDEO_VIEW_TIME, PAGE_VIDEO_VIEWS, PAGE_VIDEO_VIEWS_AUTOPLAYED, PAGE_VIDEO_VIEWS_CLICK_TO_PLAY, PAGE_VIDEO_VIEWS_ORGANIC, PAGE_VIDEO_VIEWS_PAID, PAGE_VIDEO_VIEWS_UNIQUE, PAGE_VIEWS, PAGE_VIEWS_EXTERNAL_REFERRALS, PAGE_VIEWS_LOGIN, PAGE_VIEWS_LOGIN_UNIQUE, PAGE_VIEWS_LOGOUT, PAGE_VIEWS_UNIQUE, POST_CONSUMPTIONS, POST_CONSUMPTIONS_BY_TYPE, POST_CONSUMPTIONS_BY_TYPE_UNIQUE, POST_CONSUMPTIONS_UNIQUE,
InsightName
String
POST_ENGAGED_USERS, POST_IMPRESSIONS, POST_IMPRESSIONS_BY_STORY_TYPE, POST_IMPRESSIONS_BY_STORY_TYPE_UNIQUE, POST_IMPRESSIONS_FAN, POST_IMPRESSIONS_FAN_PAID, POST_IMPRESSIONS_FAN_PAID_UNIQUE, POST_IMPRESSIONS_FAN_UNIQUE, POST_IMPRESSIONS_ORGANIC, POST_IMPRESSIONS_ORGANIC_UNIQUE, POST_IMPRESSIONS_PAID, POST_IMPRESSIONS_PAID_UNIQUE, POST_IMPRESSIONS_UNIQUE, POST_IMPRESSIONS_VIRAL, POST_IMPRESSIONS_VIRAL_UNIQUE, POST_NEGATIVE_FEEDBACK, POST_NEGATIVE_FEEDBACK_BY_TYPE, POST_NEGATIVE_FEEDBACK_BY_TYPE_UNIQUE, POST_NEGATIVE_FEEDBACK_UNIQUE, POST_STORIES, POST_STORIES_BY_ACTION_TYPE, POST_STORYTELLERS, POST_STORYTELLERS_BY_ACTION_TYPE, POST_VIDEO_AVG_TIME_WATCHED, POST_VIDEO_COMPLETE_VIEWS_ORGANIC, POST_VIDEO_COMPLETE_VIEWS_ORGANIC_UNIQUE, POST_VIDEO_COMPLETE_VIEWS_PAID, POST_VIDEO_COMPLETE_VIEWS_PAID_UNIQUE, POST_VIDEO_RETENTION_GRAPH, POST_VIDEO_RETENTION_GRAPH_AUTOPLAYED, POST_VIDEO_RETENTION_GRAPH_CLICKED_TO_PLAY, POST_VIDEO_VIEW_TIME_BY_AGE_BUCKET_AND_GENDER, POST_VIDEO_VIEW_TIME_BY_COUNTRY_ID, POST_VIDEO_VIEW_TIME_BY_DISTRIBUTION_TYPE, POST_VIDEO_VIEW_TIME_BY_REGION_ID, POST_VIDEO_VIEWS_BY_DISTRIBUTION_TYPE, POST_VIDEO_VIEWS_ORGANIC, POST_VIDEO_VIEWS_ORGANIC_UNIQUE, POST_VIDEO_VIEWS_PAID, POST_VIDEO_VIEWS_PAID_UNIQUE.
Target
String
The default target for this insight.
FromDateTime
String
The earliest date and time value for which to return insight data. This will override the Periods input and in some insights is required.
ToDateTime
String
The latest date and time value for which to return insight data. This will override the Periods input and in some insights is required.
Description
String
An optional description for the insight. This will override the description that comes from the data source.
Result Set Columns
Name
Type
Description
Result
String
Returns Success or Failure.
SchemaFile
String
The generated schema file. You will need to set the Location connection property to the folder containing your schema files.
Columns
String
The number of columns found.
GetOAuthAccessToken
Gets an authentication token from Facebook.
Input
Name
Type
Description
AuthMode
String
The type of authentication mode to use. Select App for getting authentication tokens via a windows forms app. Select Web for getting authentication tokens via a web app.
The allowed values are APP, WEB.
The default value is APP.
Permissions
String
A comma-separated list of permissions to request from the user. Please check the Facebook API for a list of available permissions. Permissions that may be required depending on your use case are: user_events,user_birthday,user_photos,user_videos,user_likes,user_hometown,user_location,user_tagged_places,read_insights,publish_actions,pages_manage_ads,pages_manage_metadata,pages_read_engagement,pages_read_user_content,pages_messaging,ads_read,publish_pages,business_management,instagram_basic,instagram_manage_insights.
CallbackUrl
String
The URL the user will be redirected to after authorizing your application. This value must match the Site URL and App Domain you have specified in the Facebook app settings. Only needed when the Authmode parameter is Web.
Verifier
String
The verifier returned from Facebook after the user has authorized your app to have access to their data. This value will be returned as a parameter to the callback URL in GetAuthURL.
AuthType
String
An optional parameter to pass Facebook. Set the value to rerequest to request the same permissions again if the user declined some of them.
State
String
Any value that you wish to be sent with the callback.
Result Set Columns
Name
Type
Description
OAuthAccessToken
String
The access token used for communication with Facebook.
ExpiresIn
String
The remaining lifetime on the access token. A -1 denotes that it will not expire.
GetOAuthAuthorizationURL
Gets an AuthURL from Facebook. You will request the auth token from this URL.
Input
Name
Type
Description
CallbackUrl
String
The URL the user will be redirected to after authorizing your application. This value must match the Site URL and App Domain in the Facebook app settings.
Permissions
String
A comma-separated list of permissions to request from the user. Please check the Facebook API for a list of available permissions. Permissions that may be required depending on your use case are: user_events,user_birthday,user_photos,user_videos,user_likes,user_hometown,user_location,user_tagged_places,read_insights,publish_actions,pages_manage_ads,pages_manage_metadata,pages_read_engagement,pages_read_user_content,pages_messaging,ads_read,publish_pages,business_management,instagram_basic,instagram_manage_insights.
AuthType
String
An optional parameter to pass Facebook. Set the value to rerequest to request the same permissions again if the user declined some of them.
State
String
Any value that you wish to be sent with the callback.
Result Set Columns
Name
Type
Description
URL
String
The authorization URL, entered into a Web browser to obtain the verifier token and authorize your app.
RefreshOAuthAccessToken
Refreshes the OAuth token.
Input
Name
Type
Description
OAuthRefreshToken
String
The refresh token returned when the OAuth Token was first created.
Result Set Columns
Name
Type
Description
OAuthAccessToken
String
The authentication token returned from Facebook.
OAuthRefreshToken
String
A token that may be used to obtain a new access token.
ExpiresIn
String
The remaining lifetime on the access token.
UploadPhoto
Post a photo to a user, page, album or event.
Input
Name
Type
Description
URL
String
An accessible URL the image will be downloaded from and then posted to the target. You need to specify either this field or FileSource.
FileSource
String
The complete filepath of the photo to be uploaded. You need to specify either this field or URL.
Target
String
The Id of the Facebook object the photo will be posted to. The object can be a user, page, album or event Id. If this target is not specified the photo will be posted to the logged user's timeline.
The default value is me.
Caption
String
Add a caption to the new post.
Publish
String
Whether to immediately publish the new post after uploading the photo. If false, the photo will be saved in a temporary upload state, where you can use the Id of the photo to insert a new photo post. Note that the unpublished photo will be deleted after 24 hours.
The default value is true.
Result Set Columns
Name
Type
Description
Id
String
The Id of the photo in the target's photo collection.
Post_Id
String
The Id of the new photo post. Will be null if 'Publish' was set to false
UploadVideo
Post a video to a user, page, group or event.
Input
Name
Type
Description
URL
String
An accessible URL the video will be downloaded from and then posted to the target. You need to specify either this field or FileSource.
FileSource
String
The complete filepath of the video to be uploaded. You need to specify either this field or URL.
Target
String
The Id of the Facebook object the video will be posted to. The object can be a user, page, group or event Id. If this target is not specified the video will be posted to the logged user's timeline.
The default value is me.
Title
String
The title to be assigned to the video post.
Description
String
Provide a description for the new post.
Result Set Columns
Name
Type
Description
Id
String
The Id of the video in the target's video collection.