![]() |
Matillion Data Model for Facebook
|
string
""
The Id of a page to retrieve data from. The page must be managed by the authenticated user; you can obtain the Ids for all such pages by querying the Pages view.
string
"OFF"
The following options are available:
string
""
As part of registering an OAuth application, you will receive the OAuthClientId value, sometimes also called a consumer key, and a client secret, the OAuthClientSecret.
string
""
As part of registering an OAuth application, you will receive the OAuthClientId, also called a consumer key. You will also receive a client secret, also called a consumer secret. Set the client secret in the OAuthClientSecret property.
string
""
The OAuthAccessToken property is used to connect using OAuth. The OAuthAccessToken is retrieved from the OAuth server as part of the authentication process. It has a server-dependent timeout and can be reused between requests.
The access token is used in place of your user name and password. The access token protects your credentials by keeping them on the server.
string
"%APPDATA%\\CData\\Facebook Data Provider\\OAuthSettings.txt"
When InitiateOAuth is set to GETANDREFRESH or REFRESH, the driver saves OAuth values to avoid requiring the user to manually enter OAuth connection properties and to allow the credentials to be shared across connections or processes.
Instead of specifying a file path, you can use memory storage. Memory locations are specified by using a value starting with 'memory://' followed by a unique identifier for that set of credentials (for example, memory://user1). The identifier can be anything you choose but should be unique to the user. Unlike file-based storage, where credentials persist across connections, memory storage loads the credentials into static memory, and the credentials are shared between connections using the same identifier for the life of the process. To persist credentials outside the current process, you must manually store the credentials prior to closing the connection. This enables you to set them in the connection when the process is started again. You can retrieve OAuth property values with a query to the sys_connection_props system table. If there are multiple connections using the same credentials, the properties are read from the previously closed connection.
The default location is "%APPDATA%\\CData\\Facebook Data Provider\\OAuthSettings.txt" with %APPDATA% set to the user's configuration directory. The default values are
where DSN is the name of the current DSN used in the open connection.
The following table lists the value of %APPDATA% by OS:
Platform | %APPDATA% |
Windows | The value of the APPDATA environment variable |
Mac | ~/Library/Application Support |
Linux | ~/.config |
string
""
During the authentication process, the OAuth authorization server redirects the user to this URL. This value must match the callback URL you specify in your app settings.
string
""
The scope that are used when authenticating to Facebook give your App access to request additional information that may be required for certain tables. Individual scope may be entered in a comma separated list. Leaving it blank will use the defaults. The Scope is only used if you have specified your own OAuthClientId and OAuthClientSecret.
You may find while using the driver that Facebook returns an error stating your app does not have permissions to do a certain action. To resolve this, you will need to generate a new OAuth access token with the required scope. Set the Scope property in the authentication step for a desktop application.
Web applications need to call the GetOAuthAuthorizationURL and GetOAuthAccessToken stored procedures, which have inputs for the scope you would like to request.
Note that these are comma-separated lists of scopes, so you can request more than one per authorization request. You can find a list of available Facebook scopes here: http://developers.facebook.com/docs/authentication/permissions/. Permissions that may be required depending on your use case are:
user_birthday, user_photos, user_videos, user_likes, user_hometown, user_location, read_insights, pages_manage_metadata, pages_read_engagement, pages_read_user_content, pages_messaging, business_management, instagram_basic, instagram_manage_insights
string
""
The verifier code returned from the OAuth authorization URL. This can be used on systems where a browser cannot be launched such as headless systems.
See Establishing a Connection to obtain the OAuthVerifier value.
Set OAuthSettingsLocation along with OAuthVerifier. When you connect, the driver exchanges the OAuthVerifier for the OAuth authentication tokens and saves them, encrypted, to the specified location. Set InitiateOAuth to GETANDREFRESH to automate the exchange.
Once the OAuth settings file has been generated, you can remove OAuthVerifier from the connection properties and connect with OAuthSettingsLocation set.
To automatically refresh the OAuth token values, set OAuthSettingsLocation and additionally set InitiateOAuth to REFRESH.
string
""
The OAuthRefreshToken property is used to refresh the OAuthAccessToken when using OAuth authentication.
string
""
Pair with OAuthTokenTimestamp to determine when the AccessToken will expire.
string
""
Pair with OAuthExpiresIn to determine when the AccessToken will expire.
string
""
If using a TLS/SSL connection, this property can be used to specify the TLS/SSL certificate to be accepted from the server. Any other certificate that is not trusted by the machine is rejected.
This property can take the following forms:
Description | Example |
A full PEM Certificate (example shortened for brevity) | -----BEGIN CERTIFICATE----- MIIChTCCAe4CAQAwDQYJKoZIhv......Qw== -----END CERTIFICATE----- |
A path to a local file containing the certificate | C:\cert.cer |
The public key (example shortened for brevity) | -----BEGIN RSA PUBLIC KEY----- MIGfMA0GCSq......AQAB -----END RSA PUBLIC KEY----- |
The MD5 Thumbprint (hex values can also be either space or colon separated) | ecadbdda5a1529c58a1e9e09828d70e4 |
The SHA1 Thumbprint (hex values can also be either space or colon separated) | 34a929226ae0819f2ec14b4a3d904f801cbb150d |
If not specified, any certificate trusted by the machine is accepted.
Certificates are validated as trusted by the machine based on the System's trust store. The trust store used is the 'javax.net.ssl.trustStore' value specified for the system. If no value is specified for this property, Java's default trust store is used (for example, JAVA_HOME\lib\security\cacerts).
Use '*' to signify to accept all certificates. Note that this is not recommended due to security concerns.
string
"NONE"
This property specifies the protocol that the driver will use to tunnel traffic through the FirewallServer proxy. Note that by default, the driver connects to the system proxy; to disable this behavior and connect to one of the following proxy types, set ProxyAutoDetect to false.
Type | Default Port | Description |
TUNNEL | 80 | When this is set, the driver opens a connection to Facebook and traffic flows back and forth through the proxy. |
SOCKS4 | 1080 | When this is set, the driver sends data through the SOCKS 4 proxy specified by FirewallServer and FirewallPort and passes the FirewallUser value to the proxy, which determines if the connection request should be granted. |
SOCKS5 | 1080 | When this is set, the driver sends data through the SOCKS 5 proxy specified by FirewallServer and FirewallPort. If your proxy requires authentication, set FirewallUser and FirewallPassword to credentials the proxy recognizes. |
To connect to HTTP proxies, use ProxyServer and ProxyPort. To authenticate to HTTP proxies, use ProxyAuthScheme, ProxyUser, and ProxyPassword.
string
""
This property specifies the IP address, DNS name, or host name of a proxy allowing traversal of a firewall. The protocol is specified by FirewallType: Use FirewallServer with this property to connect through SOCKS or do tunneling. Use ProxyServer to connect to an HTTP proxy.
Note that the driver uses the system proxy by default. To use a different proxy, set ProxyAutoDetect to false.
int
0
This specifies the TCP port for a proxy allowing traversal of a firewall. Use FirewallServer to specify the name or IP address. Specify the protocol with FirewallType.
string
""
The FirewallUser and FirewallPassword properties are used to authenticate against the proxy specified in FirewallServer and FirewallPort, following the authentication method specified in FirewallType.
string
""
This property is passed to the proxy specified by FirewallServer and FirewallPort, following the authentication method specified by FirewallType.
bool
false
This takes precedence over other proxy settings, so you'll need to set ProxyAutoDetect to FALSE in order use custom proxy settings.
NOTE: When this property is set to True, the proxy used is determined as follows:
To connect to an HTTP proxy, see ProxyServer. For other proxies, such as SOCKS or tunneling, see FirewallType.
string
""
The hostname or IP address of a proxy to route HTTP traffic through. The driver can use the HTTP, Windows (NTLM), or Kerberos authentication types to authenticate to an HTTP proxy.
If you need to connect through a SOCKS proxy or tunnel the connection, see FirewallType.
By default, the driver uses the system proxy. If you need to use another proxy, set ProxyAutoDetect to false.
int
80
The port the HTTP proxy is running on that you want to redirect HTTP traffic through. Specify the HTTP proxy in ProxyServer. For other proxy types, see FirewallType.
string
"BASIC"
This value specifies the authentication type to use to authenticate to the HTTP proxy specified by ProxyServer and ProxyPort.
Note that the driver will use the system proxy settings by default, without further configuration needed; if you want to connect to another proxy, you will need to set ProxyAutoDetect to false, in addition to ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.
The authentication type can be one of the following:
If you need to use another authentication type, such as SOCKS 5 authentication, see FirewallType.
string
""
The ProxyUser and ProxyPassword options are used to connect and authenticate against the HTTP proxy specified in ProxyServer.
You can select one of the available authentication types in ProxyAuthScheme. If you are using HTTP authentication, set this to the user name of a user recognized by the HTTP proxy. If you are using Windows or Kerberos authentication, set this property to a user name in one of the following formats:
user@domain domain\user
string
""
This property is used to authenticate to an HTTP proxy server that supports NTLM (Windows), Kerberos, or HTTP authentication. To specify the HTTP proxy, you can set ProxyServer and ProxyPort. To specify the authentication type, set ProxyAuthScheme.
If you are using HTTP authentication, additionally set ProxyUser and ProxyPassword to HTTP proxy.
If you are using NTLM authentication, set ProxyUser and ProxyPassword to your Windows password. You may also need these to complete Kerberos authentication.
For SOCKS 5 authentication or tunneling, see FirewallType.
By default, the driver uses the system proxy. If you want to connect to another proxy, set ProxyAutoDetect to false.
string
"AUTO"
This property determines when to use SSL for the connection to an HTTP proxy specified by ProxyServer. This value can be AUTO, ALWAYS, NEVER, or TUNNEL. The applicable values are the following:
AUTO | Default setting. If the URL is an HTTPS URL, the driver will use the TUNNEL option. If the URL is an HTTP URL, the component will use the NEVER option. |
ALWAYS | The connection is always SSL enabled. |
NEVER | The connection is not SSL enabled. |
TUNNEL | The connection is through a tunneling proxy. The proxy server opens a connection to the remote host and traffic flows back and forth through the proxy. |
string
""
The ProxyServer is used for all addresses, except for addresses defined in this property. Use semicolons to separate entries.
Note that the driver uses the system proxy settings by default, without further configuration needed; if you want to explicitly configure proxy exceptions for this connection, you need to set ProxyAutoDetect = false, and configure ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.
string
""
Once this property is set, the driver will populate the log file as it carries out various tasks, such as when authentication is performed or queries are executed. If the specified file doesn't already exist, it will be created.
Connection strings and version information are also logged, though connection properties containing sensitive information are masked automatically.
If a relative filepath is supplied, the location of the log file will be resolved based on the path found in the Location connection property.
For more control over what is written to the log file, you can adjust the Verbosity property.
Log contents are categorized into several modules. You can show/hide individual modules using the LogModules property.
To edit the maximum size of a single logfile before a new one is created, see MaxLogFileSize.
If you would like to place a cap on the number of logfiles generated, use MaxLogFileCount.
Java logging is also supported. To enable Java logging, set Logfile to:
Logfile=JAVALOG://myloggername
As in the above sample, JAVALOG:// is a required prefix to use Java logging, and you will substitute your own Logger.
The supplied Logger's getLogger method is then called, using the supplied value to create the Logger instance. If a logging instance already exists, it will reference the existing instance.
When Java logging is enabled, the Verbosity will now correspond to specific logging levels.
string
"1"
The verbosity level determines the amount of detail that the driver reports to the Logfile. Verbosity levels from 1 to 5 are supported. These are detailed in the Logging page.
string
""
Only the modules specified (separated by ';') will be included in the log file. By default all modules are included.
See the Logging page for an overview.
string
"100MB"
When the limit is hit, a new log is created in the same folder with the date and time appended to the end. The default limit is 100 MB. Values lower than 100 kB will use 100 kB as the value instead.
Adjust the maximum number of logfiles generated with MaxLogFileCount.
int
-1
When the limit is hit, a new log is created in the same folder with the date and time appended to the end and the oldest log file will be deleted.
The minimum supported value is 2. A value of 0 or a negative value indicates no limit on the count.
Adjust the maximum size of the logfiles generated with MaxLogFileSize.
string
"%APPDATA%\\CData\\Facebook Data Provider\\Schema"
The path to a directory which contains the schema files for the driver (.rsd files for tables and views, .rsb files for stored procedures). The folder location can be a relative path from the location of the executable. The Location property is only needed if you want to customize definitions (for example, change a column name, ignore a column, and so on) or extend the data model with new tables, views, or stored procedures.
If left unspecified, the default location is "%APPDATA%\\CData\\Facebook Data Provider\\Schema" with %APPDATA% being set to the user's configuration directory:
Platform | %APPDATA% |
Windows | The value of the APPDATA environment variable |
Mac | ~/Library/Application Support |
Linux | ~/.config |
string
""
Listing the schemas from databases can be expensive. Providing a list of schemas in the connection string improves the performance.
string
""
Listing the tables from some databases can be expensive. Providing a list of tables in the connection string improves the performance of the driver.
This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.
Specify the tables you want in a comma-separated list. Each table should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Tables=TableA,[TableB/WithSlash],WithCatalog.WithSchema.`TableC With Space`.
Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.
string
""
Listing the views from some databases can be expensive. Providing a list of views in the connection string improves the performance of the driver.
This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.
Specify the views you want in a comma-separated list. Each view should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Views=ViewA,[ViewB/WithSlash],WithCatalog.WithSchema.`ViewC With Space`.
Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.
bool
false
When AutoCache = true, the driver automatically maintains a cache of your table's data in the database of your choice. By default, the driver incrementally updates the cache, retrieving only changes since the last SELECT query was run if the length of time since the last run has exceeded the CacheTolerance. After the cache is updated, the query is executed against the cached data.
When AutoCache = true, the driver caches to a simple, file-based cache. You can configure its location or cache to a different database with the following properties:
string
""
You can cache to any database for which you have a JDBC driver, including CData JDBC drivers.
The cache database is determined by the CacheDriver and CacheConnection properties. The CacheDriver is the name of the JDBC driver class that you want to use to cache data.
Note: you must add the CacheDriver JAR file to the classpath.
The driver simplifies Derby configuration. Java DB is the Oracle distribution of Derby. The JAR file is shipped in the JDK. You can find the JAR file, derby.jar, in the db subfolder of the JDK installation. In most caching scenarios, you need to specify only the following, after adding derby.jar to the classpath:
jdbc:facebook:CacheLocation='c:/Temp/cachedir';InitiateOAuth=GETANDREFRESH;To customize the Derby JDBC URL, use CacheDriver and CacheConnection. For example, to cache to an in-memory database, use a JDBC URL like the following:
jdbc:facebook:CacheDriver=org.apache.derby.jdbc.EmbeddedDriver;CacheConnection='jdbc:derby:memory';InitiateOAuth=GETANDREFRESH;
The following is a JDBC URL for the SQLite JDBC driver:
jdbc:facebook:CacheDriver=org.sqlite.JDBC;CacheConnection='jdbc:sqlite:C:/Temp/sqlite.db';InitiateOAuth=GETANDREFRESH;
The following is a JDBC URL for the included CData JDBC Driver for MySQL:
jdbc:facebook:Cache Driver=cdata.jdbc.mysql.MySQLDriver;Cache Connection='jdbc:mysql:Server=localhost;Port=3306;Database=cache;User=root;Password=123456';InitiateOAuth=GETANDREFRESH;
The following JDBC URL uses the Microsoft JDBC Driver for SQL Server:
jdbc:facebook:Cache Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver;Cache Connection='jdbc:sqlserver://localhost\sqlexpress:7437;user=sa;password=123456;databaseName=Cache';InitiateOAuth=GETANDREFRESH;
The following is a JDBC URL for the Oracle Thin Client:
jdbc:facebook:Cache Driver=oracle.jdbc.OracleDriver;CacheConnection='jdbc:oracle:thin:scott/tiger@localhost:1521:orcldb';InitiateOAuth=GETANDREFRESH;
NOTE: If using a version of Oracle older than 9i, the cache driver will instead be oracle.jdbc.driver.OracleDriver .
The following JDBC URL uses the official PostgreSQL JDBC driver:
jdbc:facebook:CacheDriver=cdata.jdbc.postgresql.PostgreSQLDriver;CacheConnection='jdbc:postgresql:User=postgres;Password=admin;Database=postgres;Server=localhost;Port=5432;';InitiateOAuth=GETANDREFRESH;
string
""
The cache database is determined based on the CacheDriver and CacheConnection properties. Both properties are required to use the cache database. Examples of common cache database settings can be found below. For more information on setting the caching database's driver, refer to CacheDriver.
The connection string specified in the CacheConnection property is passed directly to the underlying CacheDriver. Consult the documentation for the specific JDBC driver for more information on the available properties. Make sure to include the JDBC driver in your application's classpath.
The driver simplifies caching to Derby, only requiring you to set the CacheLocation property to make a basic connection.
Alternatively, you can configure the connection to Derby manually using CacheDriver and CacheConnection. The following is the Derby JDBC URL syntax:
jdbc:derby:[subsubprotocol:][databaseName][;attribute=value[;attribute=value] ... ]
For example, to cache to an in-memory database, use the following:
jdbc:derby:memory
To cache to SQLite, you can use the SQLite JDBC driver. The following is the syntax of the JDBC URL:
jdbc:sqlite:dataSource
The installation includes the CData JDBC Driver for MySQL. The following is an example JDBC URL:
jdbc:mysql:User=root;Password=root;Server=localhost;Port=3306;Database=cache
The following are typical connection properties:
The JDBC URL for the Microsoft JDBC Driver for SQL Server has the following syntax:
jdbc:sqlserver://[serverName[\instance][:port]][;database=databaseName][;property=value[;property=value] ... ]
For example:
jdbc:sqlserver://localhost\sqlexpress:1433;integratedSecurity=true
The following are typical SQL Server connection properties:
To use integrated security, you will also need to add sqljdbc_auth.dll to a folder on the Windows system path. This file is located in the auth subfolder of the Microsoft JDBC Driver for SQL Server installation. The bitness of the assembly must match the bitness of your JVM.
The following is the conventional JDBC URL syntax for the Oracle JDBC Thin driver:
jdbc:oracle:thin:[userId/password]@[//]host[[:port][:sid]]
For example:
jdbc:oracle:thin:scott/tiger@myhost:1521:orcl
The following are typical connection properties:
Data Source: The connect descriptor that identifies the Oracle database. This can be a TNS connect descriptor, an Oracle Net Services name that resolves to a connect descriptor, or, after version 11g, an Easy Connect naming (the host name of the Oracle server with an optional port and service name).
The following is the JDBC URL syntax for the official PostgreSQL JDBC driver:
jdbc:postgresql:[//[host[:port]]/]database[[?option=value][[&option=value][&option=value] ... ]]
For example, the following connection string connects to a database on the default host (localhost) and port (5432):
jdbc:postgresql:postgres
The following are typical connection properties:
string
"%APPDATA%\\CData\\Facebook Data Provider"
The CacheLocation is a simple, file-based cache. The driver uses Java DB, Oracle's distribution of the Derby database. To cache to Java DB, you will need to add the Java DB JAR file to the classpath. The JAR file, derby.jar, is shipped in the JDK and located in the db subfolder of the JDK installation.
If left unspecified, the default location is "%APPDATA%\\CData\\Facebook Data Provider" with %APPDATA% being set to the user's configuration directory:
Platform | %APPDATA% |
Windows | The value of the APPDATA environment variable |
Mac | ~/Library/Application Support |
Linux | ~/.config |
int
600
The tolerance for stale data in the cache specified in seconds. This only applies when AutoCache is used. The driver checks with the data source for newer records after the tolerance interval has expired. Otherwise, it returns the data directly from the cache.
bool
false
When Offline = true, all queries execute against the cache as opposed to the live data source. In this mode, certain queries like INSERT, UPDATE, DELETE, and CACHE are not allowed.
bool
false
As you execute queries with this property set, table metadata in the Facebook catalog are cached to the file store specified by CacheLocation if set or the user's home directory otherwise. A table's metadata will be retrieved only once, when the table is queried for the first time.
The driver automatically persists metadata in memory for up to two hours when you first discover the metadata for a table or view and therefore, CacheMetadata is generally not required. CacheMetadata becomes useful when metadata operations are expensive such as when you are working with large amounts of metadata or when you have many short-lived connections.
string
"JSON"
The format aggregate or collection columns should return in.
int
0
When BatchSize is set to a value greater than 0, the batch operation will split the entire batch into separate batches of size BatchSize. The split batches will then be submitted to the server individually. This is useful when the server has limitations on the size of the request that can be submitted.
Setting BatchSize to 0 will submit the entire batch as specified.
int
0
The maximum lifetime of a connection in seconds. Once the time has elapsed, the connection object is disposed. The default is 0 which indicates there is no limit to the connection lifetime.
bool
false
When set to true, a connection will be made to Facebook when the connection is opened. This property enables the Test Connection feature available in various database tools.
This feature acts as a NOOP command as it is used to verify a connection can be made to Facebook and nothing from this initial connection is maintained.
Setting this property to false may provide performance improvements (depending upon the number of times a connection is opened).
int
-1
Limits the number of rows returned when no aggregation or GROUP BY is used in the query. This takes precedence over LIMIT clauses.
string
""
The properties listed below are available for specific use cases. Normal driver use cases and functionality should not require these properties.
Specify multiple properties in a semicolon-separated list.
CachePartial=True | Caches only a subset of columns, which you can specify in your query. |
QueryPassthrough=True | Passes the specified query to the cache database instead of using the SQL parser of the driver. |
DefaultColumnSize | Sets the default length of string fields when the data source does not provide column length in the metadata. The default value is 2000. |
ConvertDateTimeToGMT | Determines whether to convert date-time values to GMT, instead of the local time of the machine. |
RecordToFile=filename | Records the underlying socket data transfer to the specified file. |
string
""
The Pagesize property affects the maximum number of results to return per page from Facebook. Sometimes you may get an error asking you to request less data. The frequency of such errors can be reduced by reducing the pagesize. The maximum pagesize tends to be about 100 per page.
int
60
The allowed idle time a connection can remain in the pool until the connection is closed. The default is 60 seconds.
int
100
The maximum connections in the pool. The default is 100. To disable this property, set the property value to 0 or less.
int
1
The minimum number of connections in the pool. The default is 1.
int
60
The max seconds to wait for a connection to become available. If a new connection request is waiting for an available connection and exceeds this time, an error is thrown. By default, new requests wait forever for an available connection.
string
""
This setting is particularly helpful in Entity Framework, which does not allow you to set a value for a pseudo column unless it is a table column. The value of this connection setting is of the format "Table1=Column1, Table1=Column2, Table2=Column3". You can use the "*" character to include all tables and all columns; for example, "*=*".
bool
false
If this property is set to true, the driver will allow only SELECT queries. INSERT, UPDATE, DELETE, and stored procedure queries will cause an error to be thrown.
string
""
The RTK property may be used to license a build. See the included licensing file to see how to set this property. The runtime key is only available if you purchased an OEM license.
string
""
A default target if none is specified. Used for some tables, such as Comments, where a target may be specified.
int
60
If Timeout = 0, operations do not time out. The operations run until they complete successfully or until they encounter an error condition.
If Timeout expires and the operation is not yet complete, the driver throws an exception.
bool
false
The UploadLinkedMedia determines whether to upload media before inserting a Post. If set to True, when you attempt to insert a new Post with the Link column, the driver will first attempt to resolve the URL and determine if the URL is referencing a photo or a video. If so, the photo or video will be uploaded first, then a new Post containing the media will be created. If False, then the new Post will be created as a Link Post.
bool
false
This property enables connection pooling. The default is false. See Connection Pooling for information on using connection pools.
string
""
User Defined Views are defined in a JSON-formatted configuration file called UserDefinedViews.json. The driver automatically detects the views specified in this file.
You can also have multiple view definitions and control them using the UserDefinedViews connection property. When you use this property, only the specified views are seen by the driver.
This User Defined View configuration file is formatted as follows:
For example:
{ "MyView": { "query": "SELECT * FROM Posts WHERE MyColumn = 'value'" }, "MyView2": { "query": "SELECT * FROM MyTable WHERE Id IN (1,2,3)" } }Use the UserDefinedViews connection property to specify the location of your JSON configuration file. For example:
"UserDefinedViews", C:\Users\yourusername\Desktop\tmp\UserDefinedViews.jsonNote that the specified path is not embedded in quotation marks.
Create, delete, and query the Likes for a Target. Alternatively, lists Pages that the specified User or Page Likes. Authentication is required to use this table.
Likes is an advanced table and require you to set the Target column in the SQL query.
Likes in Facebook represent the users that like a particular target. The target may be a post, picture, or other type of valid entity that may have likes associated with it.
Note: At this time, the Likes table cannot retrieve likes or other reactions for pages. To retrieve simple insights for pages under the new Page experience from Facebook, see PageAndPostInsights.
When selecting likes, specify a target. The target represents the username or Id of the entity that likes are being retrieved for. For example:
SELECT Id, Name, Picture FROM Likes WHERE Target = '15526475270_410830705612736'
If a user or page is specified as the target for likes, then the pages that the user or page likes will be returned. For example:
SELECT Id, Name, Username, Category FROM Likes WHERE Target = 'facebook'
If no target is specified, the currently authenticated user will be used as the target. In this case, the pages that the authenticated user likes will be returned.
Name | Type | ReadOnly | Description |
ID [KEY] | String | True |
The Id of a user who likes the target, which may or may not be combined with the target Id. The user Id will be after the final '_'. |
Target [KEY] | String | False |
The Id or username of the target being liked. This may be a post, page, picture, or other valid id with likes. |
Name | String | True |
The name of the user who likes the target. May alternatively be the name of a page. |
Username | String | True |
The username of a page when retrieving pages a page has liked. |
Picture | String | True |
Picture of the user who likes the target. May alternatively be the picture of a page. |
Category | String | True |
The category of the user or page. |
CreatedTime | Datetime | True |
The time the like was created, if available. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
offset | String |
Which result to begin returning results from. Used for manual paging of results. |
Create, delete, and query the Posts for a Target based on either the Target or Id. Posts can also be inserted based on a Target, or deleted based on Id. This table requires authentication.
Posts in Facebook are posts to a user's profile feed. Posts can be made to a user, page, application, group, or event.
Note: Due to a deprecation in the Facebook API, queries to the Comments, Photos, Posts, and Videos views where a user profile is either the defined or default target, no longer return data for the following fields:
When selecting posts, a target may be specified. The target represents a page or another valid entity that may have posts for it. If no target is specified, the authenticated user will be used as the target. For example, to retrieve posts made by a page:
SELECT * FROM Posts WHERE Target = 'PageId'
If you know the post Id, you can specify the Id to obtain information about the specific post. For example:
SELECT * FROM Posts WHERE Id = 'PostId'
When querying posts, elements may be retrieved by specifying either the CreatedTime or the UpdatedTime. For example:
SELECT * FROM Posts WHERE Target = 'facebook' AND CreatedTime >= '1/1/2012' AND CreatedTime <= '2/1/2012'
Name | Type | ReadOnly | Description |
ID [KEY] | String | True |
The Id of the post. |
Target | String | False |
The Id or username of the target you are retrieving posts for or are posting to. This can be an event, group, page, or user. |
FromId | String | True |
Id of the user who made the post. |
FromName | String | True |
Name of the user who made the post. |
FromPicture | String | True |
Picture of the user who made the post. |
FromCategory | String | True |
Category of the user who made the post. FromCategory can only be retrieved if the other From* fields are not selected. |
ToData | String | True |
An aggregate of users the post was made to. |
Message | String | False |
The message of the post. A message is required when inserting a post. |
MessageTags | String | True |
An aggregate of objects tagged in the message such as users, pages, etc. |
Attachments | String | True |
An aggregate for the attachments of the post. |
Picture | String | False |
A link to the picture included in the post. |
FullPicture | String | False |
A link to the original picture included in the post. The one listed in Picture may be a resized smaller version. |
Icon | String | True |
Link to an icon representing the type of post. |
Actions | String | True |
An aggregate of available actions on the post such as commenting or liking. |
CommentsCount | Integer | True |
The number of comments for the post. |
LikesCount | Integer | True |
The number of times the post has been liked. |
SharesCount | Integer | True |
The number of times the post has been shared. |
PlaceId | String | False |
The Id of the location associated with the post, if any. |
PlaceName | String | True |
The name of the location associated with the post, if any. |
ApplicationId | String | True |
Id of the application this post came from. |
ApplicationName | String | True |
Name of the application this post came from. |
ApplicationCanvasName | String | True |
Information about the application used to create the entity. |
ApplicationNamespace | String | True |
Information about the application used to create the entity. |
Story | String | True |
Text of stories not intentionally generated by users, such as those generated when two users become friends; you must have the Include Recent Activity Stories migration enabled in your app to retrieve these stories. Requires the read_stream permission. |
StoryTags | String | True |
An aggregate of objects (users, pages, etc.) associated with the story. |
LikesData | String | True |
An aggregate of like data. |
CommentsData | String | True |
An aggregate of comments for this post. |
CreatedTime | Datetime | True |
When the post was created. |
UpdatedTime | Datetime | True |
When the post was last updated. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
TaggedUser | String |
If set to an Id or username, it will retrieve posts where the specified user has been tagged. Requires the read_stream permission. |
LocationUser | String |
If set to an Id or username, it will retrieve location posts where the user has been tagged. Requires the user_photos and user_status permissions. |
Link | String |
A link to attach to the post. For use with the creation of posts. For post creation, either Link or Message columns are required. |
Create, update, delete, and query the Comments for a Target. Comments may also be inserted based on a Target or deleted based on Id.
Comments in Facebook are comments about a specific thing. They are always associated with a target, which is the item the comment is directed toward. For example, this could be a post, a picture, or a video. Using this table, you can list the comments for a specific target and also insert new comments about a target.
Note: Due to a deprecation in the Facebook API, queries to the Comments, Photos, Posts, and Videos views where a user profile is either the defined or default target, no longer return data for the following fields:
When querying comments, either the Target or the Id of the comment may be specified. For example, to retrieve all the comments about a specific post, your SELECT statement could look something like this:
SELECT * FROM Comments WHERE Target = '15526475270_410830705612736'
Alternatively, you can specify the Id to retrieve a specific comment. For example:
SELECT * FROM Comments WHERE Id = '15526475270_410830705612736_5193593'
If no Target or Id is specified, comments will be queried from the posts of the feed of the currently authenticated user or page.
Multiple queries can also be composed together to retrieve comments from posts across multiple Facebook entities. For instance:
SELECT * FROM Comments WHERE Target IN (SELECT Id FROM Posts WHERE Target IN (SELECT Id FROM Pages))
If you are looking for comments for all posts, please consider looking at the Posts table or the Wall view. They contain the columns 'CommentsData' and 'CommentsCount'. 'CommentsCount' can be queried to filter and only select posts (targets) on which a comment has been made:
SELECT * FROM Wall WHERE CommentsCount > 0
Name | Type | Description |
ID [KEY] | String | The Id of the comment. |
Target | String | The Id of the target you are retrieving comments for. This may be an album, checkin, link, note, photo, post, status update, or video. |
FromId | String | Id of the user who made the comment. |
FromName | String | Name of the user who made the comment. |
FromPicture | String | Picture of the user who made the comment. |
Message | String | The text of the comment. |
MessageTags | String | Aggregate of tags contained in the message. |
Likes | Integer | The number of likes the comment has. |
CommentsCount | Integer | The number of comments in reply to this comment. |
LikesData | String | Aggregate of likes information on the comment. |
UserLikes | Boolean | Boolean indicating if the authenticated user likes the comment. |
CanRemove | Boolean | Boolean indicating if the comment can be removed. |
Attachments | String | An aggregate for the attachments of the post. |
CreatedTime | Datetime | The time the comment was created. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
offset | String | Which result to begin returning results from. Used for manual paging of results. |
Query the Events for a Target such as a page id.
Events in Facebook are events created by a user or page that mark a specific date when something will take place. Events may be queried by Target or Id.
When selecting events, a target may be specified. The target represents a page that has created events. By default, this will be the currently authenticated user or page. For example, to retrieve events associated with a page:
SELECT * FROM Events WHERE Target = 'PageId'
If you know the event Id, you may also just specify the Id to obtain information about the specific event. For example:
SELECT * FROM Events WHERE Id = 'EventId'
Name | Type | Description |
ID [KEY] | String | The Id of the event. |
Target | String | The Id or username of the target you are retrieving events for or are posting events to. This may be a page or a user. |
Name | String | The name of the event. |
StartTime | Datetime | The start time of the event. |
EndTime | Datetime | The end time of the event. |
Timezone | String | The time zone the event will take place in. |
Description | String | The description of the event. |
Picture | String | A URL to the picture of the event. |
OwnerId | String | The Id of the user that created the event. |
OwnerName | String | The name of the user that created the event. |
OwnerPicture | String | Picture of the user who created the event. |
OwnerCategory | String | Category of the owner, if available. |
Location | String | The location of the event, if specified. |
LocationId | String | The Id of the location for the event. |
LocationStreet | String | The street address of the event. |
LocationCity | String | The the city for the event. |
LocationState | String | The the state for the event. |
LocationCountry | String | The the country for the event. |
LocationZip | String | The the ZIP code of the event. |
LocationLatitude | String | The latitude of the event. |
LocationLongitude | String | The longitude of the event. |
TicketUri | String | A URL to a location to buy tickets for this event. |
UpdatedTime | Datetime | When the event was last updated. |
AttendingCount | Integer | Number of people attending the event. |
DeclinedCount | Integer | Number of people who declined the event. |
InterestedCount | Integer | Number of people interested in the event. |
MaybeCount | Integer | Number of people who maybe going to the event. |
NoreplyCount | Integer | Number of people who did not reply to the event. |
Query the Pages based on the supplied Id.
Groups are a place to communicate about shared interests with certain people. Groups may be queried by Id.
If you know the groups Id, you may also just specify the Id to obtain information about the specific group. For example:
SELECT * FROM Groups WHERE Id = 'GroupId'
Name | Type | Description |
ID [KEY] | String | The Group ID. |
Name | String | The name of the Group. |
Description | String | A brief description of the Group. |
String | The email address to upload content to the Group. Only current members of the Group can use this. | |
Icon | String | The URL for the Group's icon. |
MemberCount | Integer | The number of members in the Group. |
MemberRequestCount | Integer | The number of members in the Group. |
CoverId | String | Id of the cover image for the group. |
CoverSource | String | The URL to the cover image for the group. |
CoverOffsetY | String | The y-axis offset of the cover image for the group. |
CoverOffsetX | String | The x-axis offset of the cover image for the group. |
Permissions | String | The permissions a User has granted for an app installed in the Group. |
Privacy | String | The privacy setting of the Group. Possible values are CLOSED, OPEN, and SECRET. Requires an access token of an Admin of the Group. |
UpdatedTime | Datetime | The last time the Group was updated (includes changes Group properties, Posts, and Comments). Requires an access token of an Admin of the Group. |
Allows retrieval of insights by consumption type.
Insights by consumption type refers to any insights that can be retrieved from a page or post that measure how users consumed your content.
When selecting insights, a Target must be specified. In addition, an InsightName and Period should always be specified. For instance:
SELECT * FROM InsightsByConsumptionType WHERE Target = 'mypostid' AND InsightName = 'PAGE_CONSUMPTIONS_BY_CONSUMPTION_TYPE' AND Period = 'day'
Additionally, StartTime and EndTime can be used to specify a range where insight data should be drawn from:
SELECT * FROM InsightsByConsumptionType WHERE Target = 'mypostid' AND InsightName = 'PAGE_CONSUMPTIONS_BY_CONSUMPTION_TYPE' AND Period = 'day' AND EndTime >= '12/1/2015' AND EndTime <= '12/31/2015'
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Datetime | The most recent date this insight data is relevant for. |
VideoPlay | Long | Insight column indication the total for the stated consumption type. |
OtherClicks | Long | Insight column indication the total for the stated consumption type. |
PhotoView | Long | Insight column indication the total for the stated consumption type. |
LinkClicks | Long | Insight column indication the total for the stated consumption type. |
ButtonClicks | Long | Insight column indication the total for the stated consumption type. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: PAGE_CONSUMPTIONS_BY_CONSUMPTION_TYPE,PAGE_CONSUMPTIONS_BY_CONSUMPTION_TYPE_UNIQUE,POST_CLICKS_BY_TYPE,POST_CLICKS_BY_TYPE_UNIQUE |
Period | String | The period for the insight. This must always be specified.
The allowed values are day, week, days_28, lifetime. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows retrieval of insights by feedback type.
Insights by feedback type refers to any insights that can be retrieved from a page or post that measure what kind of feedback was left.
When selecting insights, a Target must be specified. In addition, an InsightName and Period should always be specified. For instance:
SELECT * FROM InsightsByFeedbackType WHERE Target = 'mypostid' AND InsightName = 'PAGE_POSITIVE_FEEDBACK_BY_TYPE' AND Period = 'day'
Additionally, StartTime and EndTime can be used to specify a range where insight data should be drawn from:
SELECT * FROM InsightsByFeedbackType WHERE Target = 'mypostid' AND InsightName = 'PAGE_POSITIVE_FEEDBACK_BY_TYPE' AND Period = 'day' AND EndTime >= '12/1/2015' AND EndTime <= '12/31/2015'
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
Like | Long | Insight column indication the total for the positive feedback type. |
Comment | Long | Insight column indication the total for the positive feedback type. |
Link | Long | Insight column indication the total for the positive feedback type. |
Answer | Long | Insight column indication the total for the positive feedback type. |
Claim | Long | Insight column indication the total for the positive feedback type. |
Rsvp | Long | Insight column indication the total for the positive feedback type. |
HideAllClicks | Long | Insight column indication the total for the negative feedback type. |
HideClicks | Long | Insight column indication the total for the negative feedback type. |
UnlikePageClicks | Long | Insight column indication the total for the negative feedback type. |
ReportSpamClicks | Long | Insight column indication the total for the negative feedback type. |
XButtonClicks | Long | Insight column indication the total for the negative feedback type. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: PAGE_NEGATIVE_FEEDBACK_BY_TYPE,PAGE_NEGATIVE_FEEDBACK_BY_TYPE_UNIQUE,PAGE_POSITIVE_FEEDBACK_BY_TYPE,PAGE_POSITIVE_FEEDBACK_BY_TYPE_UNIQUE,POST_NEGATIVE_FEEDBACK_BY_TYPE,POST_NEGATIVE_FEEDBACK_BY_TYPE_UNIQUE |
Period | String | The period for the insight. This must always be specified.
The allowed values are day, week, days_28, lifetime. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows retrieval of insights by like source type.
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
Ads | Long | Insight column indication the total for the like source type. |
NewsFeed | Long | Insight column indication the total for the like source type. |
Other | Long | Insight column indication the total for the like source type. |
PageSuggestions | Long | Insight column indication the total for the like source type. |
RestoredLikesFromReactivatedAccounts | Long | Insight column indication the total for the like source type. |
Search | Long | Insight column indication the total for the like source type. |
YourPage | Long | Insight column indication the total for the like source type. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: PAGE_FANS_BY_LIKE_SOURCE,PAGE_FANS_BY_LIKE_SOURCE_UNIQUE |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows retrieval of insights by like source type.
Insights by reaction total type refers to the reaction totals for your page or post.
When selecting insights, a Target must be specified. This should be set to a page or post depending on the InsightName specified. You can set InsightName to 'PAGE_ACTIONS_POST_REACTIONS_TOTAL' or 'POST_REACTIONS_BY_TYPE_TOTAL', by default it will be 'PAGE_ACTIONS_POST_REACTIONS_TOTAL'. For instance:
SELECT * FROM InsightsByReactionTotals WHERE Target = 'mypageid' AND InsightName = 'PAGE_ACTIONS_POST_REACTIONS_TOTAL'
Additionally, StartTime and EndTime can be used to specify a range where insight data should be drawn from:
SELECT * FROM InsightsByReactionTotals WHERE Target = 'mypageid' AND InsightName = 'PAGE_ACTIONS_POST_REACTIONS_TOTAL' AND EndTime >= '12/1/2015' AND EndTime <= '12/31/2015'
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
Like | Long | Total like reactions. |
Love | Long | Total love reactions. |
Wow | Long | Total wow reactions. |
Haha | Long | Total haha reactions. |
Sorry | Long | Total sorry reactions. |
Anger | Long | Total anger reactions. |
Target | String | The target of the insight. This must always be specified. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
InsightName | String | Insight Name. The available values are: PAGE_ACTIONS_POST_REACTIONS_TOTAL,POST_REACTIONS_BY_TYPE_TOTAL
The default value is PAGE_ACTIONS_POST_REACTIONS_TOTAL. |
Allows retrieval of insights by like story type.
Insights by story type refers to any insights that can be retrieved from a page or post that measure the types of stories that have occurred.
When selecting insights, a Target must be specified. In addition, an InsightName and Period should always be specified. For instance:
SELECT * FROM InsightsByStoryType WHERE Target = 'mypostid' AND InsightName = 'PAGE_STORIES_BY_STORY_TYPE' AND Period = 'day'
Additionally, StartTime and EndTime can be used to specify a range where insight data should be drawn from:
SELECT * FROM InsightsByStoryType WHERE Target = 'mypostid' AND InsightName = 'PAGE_STORIES_BY_STORY_TYPE' AND Period = 'day' AND EndTime >= '12/1/2015' AND EndTime <= '12/31/2015'
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
UserPost | Long | Insight column indication the total for the stated story type. |
PagePost | Long | Insight column indication the total for the stated story type. |
Checkin | Long | Insight column indication the total for the stated story type. |
Fan | Long | Insight column indication the total for the stated story type. |
Question | Long | Insight column indication the total for the stated story type. |
Coupon | Long | Insight column indication the total for the stated story type. |
Event | Long | Insight column indication the total for the stated story type. |
Mention | Long | Insight column indication the total for the stated story type. |
Other | Long | Insight column indication the total for the stated story type. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: PAGE_CONTENT_ACTIVITY_BY_ACTION_TYPE,PAGE_IMPRESSIONS_BY_STORY_TYPE,PAGE_IMPRESSIONS_BY_STORY_TYPE_UNIQUE,POST_IMPRESSIONS_BY_STORY_TYPE,POST_IMPRESSIONS_BY_STORY_TYPE_UNIQUE |
Period | String | The period for the insight. This must always be specified.
The allowed values are day, week, days_28, lifetime. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows retrieval of insights by tab type..
Insights by tab type refers to any insights that can be retrieved from a page or post that measure what tab was used to view your content.
When selecting insights, a Target must be specified. In addition, an InsightName and Period should always be specified. For instance:
SELECT * FROM InsightsByTabType WHERE Target = 'mypostid' AND InsightName = 'PAGE_TAB_VIEWS_LOGIN_TOP_UNIQUE' AND Period = 'day'
Additionally, StartTime and EndTime can be used to specify a range where insight data should be drawn from:
SELECT * FROM InsightsByTabType WHERE Target = 'mypostid' AND InsightName = 'PAGE_TAB_VIEWS_LOGIN_TOP_UNIQUE' AND Period = 'day' AND EndTime >= '12/1/2015' AND EndTime <= '12/31/2015'
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
About | Long | Insight column indication the total for the tab type. |
Ads | Long | Insight column indication the total for the tab type. |
Album | Long | Insight column indication the total for the tab type. |
AllActivity | Long | Insight column indication the total for the tab type. |
App | Long | Insight column indication the total for the tab type. |
Community | Long | Insight column indication the total for the tab type. |
Events | Long | Insight column indication the total for the tab type. |
Home | Long | Insight column indication the total for the tab type. |
Info | Long | Insight column indication the total for the tab type. |
Insights | Long | Insight column indication the total for the tab type. |
Jobs | Long | Insight column indication the total for the tab type. |
Likes | Long | Insight column indication the total for the tab type. |
Locations | Long | Insight column indication the total for the tab type. |
Notes | Long | Insight column indication the total for the tab type. |
Photos | Long | Insight column indication the total for the tab type. |
PhotosAlbums | Long | Insight column indication the total for the tab type. |
PhotosStream | Long | Insight column indication the total for the tab type. |
Posts | Long | Insight column indication the total for the tab type. |
Profile | Long | Insight column indication the total for the tab type. |
ProfileAbout | Long | Insight column indication the total for the tab type. |
ProfileCommunity | Long | Insight column indication the total for the tab type. |
ProfileHome | Long | Insight column indication the total for the tab type. |
ProfileInfo | Long | Insight column indication the total for the tab type. |
ProfileLikes | Long | Insight column indication the total for the tab type. |
ProfilePhotos | Long | Insight column indication the total for the tab type. |
ProfilePosts | Long | Insight column indication the total for the tab type. |
Reviews | Long | Insight column indication the total for the tab type. |
Timeline | Long | Insight column indication the total for the tab type. |
Videos | Long | Insight column indication the total for the tab type. |
Wall | Long | Insight column indication the total for the tab type. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: PAGE_TAB_VIEWS_LOGIN_TOP_UNIQUE,PAGE_TAB_VIEWS_LOGIN_TOP,PAGE_TAB_VIEWS_LOGOUT_TOP |
Period | String | The period for the insight. This must always be specified.
The allowed values are day, week. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows retrieval of insights by like source type.
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
DeactivatedOrMemorializedAccountRemovals | Long | Insight column indication the total for the like source type. |
SuspiciousAccountRemovals | Long | Insight column indication the total for the like source type. |
UnlikesFromPagePostsOrNewsFeed | Long | Insight column indication the total for the like source type. |
UnlikesFromSearch | Long | Insight column indication the total for the like source type. |
UnderageAccountRemovals | Long | Insight column indication the total for the like source type. |
UnlikesFromPageSuggestions | Long | Insight column indication the total for the like source type. |
Other | Long | Insight column indication the total for the like source type. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: PAGE_FANS_BY_UNLIKE_SOURCE,PAGE_FANS_BY_UNLIKE_SOURCE_UNIQUE |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows you to get insights for an Instagram Business Account. Requires the instagram_basic and instagram_manage_insights scopes.
Name | Type | Description |
RowNumber [KEY] | String | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
Value | Long | Insight column for a singular value response. |
Description | String | The period for the insight. This controls how rows will be broken up (by day, week, 28 days, or lifetime). This must always be specified.
The allowed values are day, week, days_28, lifetime. |
InsightName | String | The name of the insight. This must always be specified. The available values are: IMPRESSIONS,REACH,FOLLOWER_COUNT,EMAIL_CONTACTS,PHONE_CALL_CLICKS,TEXT_MESSAGE_CLICKS,GET_DIRECTIONS_CLICKS,WEBSITE_CLICKS,PROFILE_VIEWS,AUDIENCE_GENDER_AGE,AUDIENCE_COUNTRY,AUDIENCE_CITY,ONLINE_FOLLOWERS |
InsightBreakdownValue | String | The values for an insight breakdown. Applies to AUDIENCE_GENDER_AGE, AUDIENCE_COUNTRY, AUDIENCE_CITY. |
Period | String | The period for the insight. This controls how rows will be broken up (by day, week, 28 days, or lifetime). This must always be specified. Only 'lifetime' is valid for AUDIENCE_GENDER_AGE, AUDIENCE_COUNTRY, and AUDIENCE_CITY.
The allowed values are day, week, days_28, lifetime. |
Timeframe | String | Designates how far to look back for data. Required for AUDIENCE_GENDER_AGE, AUDIENCE_COUNTRY, and AUDIENCE_CITY, and takes the place of FromDateTime and ToDateTime inputs for these insights.
The allowed values are last_14_days, last_30_days, last_90_days, prev_month, this_month, this_week. |
Target | String | The target of the insight. This value correspond to the InstagramBusinessAccountId of the Pages view. You can also set it to 'Target IN (SELECT InstagramBusinessAccountId FROM Pages)'. This must always be specified. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows the retrieval of simple insights with a single value in the response.
Page and Post insights that can be retrieved from a page or post. These kinds of insights have a single value in the response and can only be filtered by a few values.
When selecting Page and Post insights, always specify a Target, an InsightName, and a Period. For example:
SELECT * FROM PageAndPostInsights WHERE Target = 'mypageid' AND InsightName = 'PAGE_IMPRESSIONS' AND Period = 'day'
To specify multiple insights, use the IN operator. For example:
SELECT * FROM PageAndPostInsights WHERE Target = 'mypageid' AND InsightName IN ('PAGE_IMPRESSIONS', 'PAGE_ENGAGED_USERS') AND Period = 'day'
To specify a range within which insight data should be drawn, use StartTime and EndTime. For example:
SELECT * FROM PageAndPostInsights WHERE Target = 'mypageid' AND InsightName = 'PAGE_IMPRESSIONS' AND Period = 'day' AND EndTime >= '12/1/2015' AND EndTime <= '12/31/2015'
Note: Be aware that not all periods are available for all insights. Some will support the use of day/week/days_28 available, but others may only support lifetime. If you are not sure what periods are supported for the insight of interest, see https://developers.facebook.com/docs/graph-api/reference/insights.
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
EndTime | Date | The most recent date this insight data is relevant for. |
Value | Long | Insight column for a singular value response. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: PAGE_ACTIONS_POST_REACTIONS_ANGER_TOTAL, PAGE_ACTIONS_POST_REACTIONS_HAHA_TOTAL, PAGE_ACTIONS_POST_REACTIONS_LIKE_TOTAL, PAGE_ACTIONS_POST_REACTIONS_LOVE_TOTAL, PAGE_ACTIONS_POST_REACTIONS_SORRY_TOTAL, PAGE_ACTIONS_POST_REACTIONS_WOW_TOTAL, PAGE_CONSUMPTIONS, PAGE_CONSUMPTIONS_UNIQUE, PAGE_ENGAGED_USERS, PAGE_FAN_ADDS, PAGE_FAN_ADDS_UNIQUE, PAGE_FAN_REMOVES, PAGE_FAN_REMOVES_UNIQUE, PAGE_FANS, PAGE_FANS_ONLINE, PAGE_FANS_ONLINE_PER_DAY, PAGE_IMPRESSIONS, 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_IMPRESSIONS_NONVIRAL, PAGE_IMPRESSIONS_NONVIRAL_UNIQUE, PAGE_NEGATIVE_FEEDBACK, PAGE_NEGATIVE_FEEDBACK_UNIQUE, PAGE_PLACES_CHECKIN_MOBILE, PAGE_PLACES_CHECKIN_MOBILE_UNIQUE, PAGE_PLACES_CHECKIN_TOTAL, PAGE_PLACES_CHECKIN_TOTAL_UNIQUE, PAGE_POST_ENGAGEMENTS, PAGE_POSTS_IMPRESSIONS, 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_CONTENT_ACTIVITY, 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_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_TOTAL, PAGE_VIEWS_LOGGED_IN_TOTAL, PAGE_VIEWS_LOGGED_IN_UNIQUE, PAGE_VIEWS_LOGOUT, PAGE_VIEWS_UNIQUE, POST_CLICKS, POST_CLICKS_UNIQUE, POST_ENGAGED_USERS, POST_IMPRESSIONS, 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_UNIQUE, POST_ACTIVITY, POST_ACTIVITY_UNIQUE, 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_LENGTH, POST_VIDEO_VIEW_TIME, POST_VIDEO_VIEW_TIME_ORGANIC, POST_VIDEO_VIEWS_10S, POST_VIDEO_VIEWS_10S_AUTOPLAYED, POST_VIDEO_VIEWS_10S_CLICKED_TO_PLAY, POST_VIDEO_VIEWS_10S_ORGANIC, POST_VIDEO_VIEWS_10S_PAID, POST_VIDEO_VIEWS_10S_SOUND_ON, POST_VIDEO_VIEWS_10S_UNIQUE, POST_VIDEO_VIEWS_ORGANIC, POST_VIDEO_VIEWS_ORGANIC_UNIQUE, POST_VIDEO_VIEWS_PAID, POST_VIDEO_VIEWS_PAID_UNIQUE, POST_VIDEO_VIEWS_SOUND_ON |
Period | String | The period for the insight. This controls how rows will be broken up (by day, week, 28 days, or lifetime). This must always be specified.
The allowed values are day, week, days_28, lifetime. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Query the Pages based on the supplied Id.
Pages in Facebook are pages that are created by a user and may be maintained by one or multiple users. Pages, like users, may be referred to by Id or by screen name.
When querying pages, if nothing is specified then the pages you administrate will be displayed by default. Otherwise, the Id of the page can be specified. For example:
SELECT * FROM Pages WHERE Id = 'facebook'
Name | Type | Description |
ID [KEY] | String | The Id of the page. |
Username | String | The username for the page, if any. |
Name | String | The name of the page. |
Category | String | The category of the page. |
Categories | String | An aggregate of categories associated with the page if multiple categories are available. |
Link | String | A link to the page. |
Picture | String | A link to the profile picture of the page for the page. |
CoverId | String | Id of the cover image for the page. |
CoverSource | String | The URL to the cover image for the page. |
CoverOffsetY | String | The y-axis offset of the cover image for the page. |
CoverOffsetX | String | The x-axis offset of the cover image for the page. |
About | String | Basic information about the page. |
Description | String | A description of the page, if available. |
GeneralInfo | String | General information provided by the page. |
LocationStreet | String | The street address of the page. |
LocationCity | String | The city for the page. |
LocationState | String | The state for the page. |
LocationCountry | String | The country for the page. |
LocationZip | String | The ZIP code of the page. |
LocationLatitude | String | The latitude of the page. |
LocationLongitude | String | The longitude of the page. |
StoreNumber | Integer | Unique store number for this location page, if applicable. |
Phone | String | The phone number of the page, if available. |
Website | String | A link to the website for the page. |
Likes | Integer | The number of people who like the page. |
Checkins | Integer | The total number of users who have checked in to the place associated with the page. |
TalkingAboutCount | Integer | The number of users talking about the page. |
WereHereCount | Integer | The number of users who were at the location the page is for, if applicable. |
CanPost | Boolean | Boolean indicating if the authenticated user can post of the page for the page. |
IsPublished | Boolean | Boolean indicating if the page for the page has been published. |
IsCommunityPage | Boolean | Boolean indicating if this is a community page. |
PublicTransit | String | The public transit available for the page, if any. |
ParkingStreet | Boolean | Boolean indicating if street parking is available. |
ParkingLot | Boolean | Boolean indicating if a parking lot is available. |
ParkingValet | Boolean | Boolean indicating if valet parking is available. |
PromotionEligible | Boolean | Boosted posts eligibility status. Requires the manage_pages permission and you must be an administrator of the page. |
PromotionIneligibleReason | String | Reason boosted posts are not eligible. Requires the manage_pages permission and you must be an administrator of the page. |
Founded | String | When the company is founded. Applicable to companies. |
Mission | String | The company mission. Applicable to companies. |
Products | String | The products of this company. Applicable to companies. |
Hours | String | An aggregate for the hours of operation. Applicable to businesses and places. |
Attire | String | Dress code of the business. Applicable to restaurants or nightlife. Valid values are Casual, Dressy or Unspecified. |
AcceptsCashOnly | Boolean | Whether the business accepts only cash as a payment option. Applicable to restaurants or nightlife. |
AcceptsVisa | Boolean | Whether the business accepts Visa as a payment option. Applicable to restaurants or nightlife. |
AcceptsAmericanExpress | Boolean | Whether the business accepts American Express as a payment option. Applicable to restaurants or nightlife. |
AcceptsMasterCard | Boolean | Whether the business accepts MasterCard as a payment option. Applicable to restaurants or nightlife. |
AcceptsDiscover | Boolean | Whether the business accepts Discover as a payment option. Applicable to restaurants or nightlife. |
PriceRange | String | Price range of the business. Applicable to restaurants or nightlife. Valid values are \$ (0-10), \$\$ (10-30), \$\$\$ (30-50), \$\$\$\$ (50+), or Unspecified. |
TakesReservations | Boolean | Whether the restaurant takes reservations. Only applicable to restaurants. |
AllowsWalkins | Boolean | Whether the restaurant allows walk-ins. Only applicable to restaurants. |
AllowsGroups | Boolean | Whether the restaurant accommodates groups. Only applicable to restaurants. |
AllowsKids | Boolean | Whether the restaurant allows kids. Only applicable to restaurants. |
ProvidesTakeout | Boolean | Whether the restaurant provides a takeout service. Only applicable to restaurants. |
ProvidesDelivery | Boolean | Whether the restaurant provides a delivery service. Only applicable to restaurants. |
ProvidesCatering | Boolean | Whether the restaurant provides a catering service. Only applicable to restaurants. |
HasWaiters | Boolean | Whether the restaurant has waiters. Only applicable to restaurants. |
HasOutdoorSeating | Boolean | Whether the restaurant has outdoor seating. Only applicable to restaurants. |
ServesBreakfast | Boolean | Whether the restaurant serves breakfast. Only applicable to restaurants. |
ServesLunch | Boolean | Whether the restaurant serves lunch. Only applicable to restaurants. |
ServesDinner | Boolean | Whether the restaurant serves dinner. Only applicable to restaurants. |
ServesCoffee | Boolean | Whether the restaurant serves coffee. Only applicable to restaurants. |
ServesDrinks | Boolean | Whether the restaurant serves drinks. Only applicable to restaurants. |
CulinaryTeam | String | Culinary team of the business. Applicable to restaurants or nightlife. |
PharmaSafetyInfo | String | Pharmacy safety information. Applicable to pharmaceutical companies. |
Affiliation | String | Affiliation of this person. Applicable to pages representing people. |
Birthday | String | Birthday of this person. Applicable to pages representing people. |
PersonalInfo | String | Personal information. Applicable to pages representing people. |
PersonalInterests | String | Personal interests. Applicable to pages representing people. |
ArtistsWeLike | String | Artists the band likes. Applicable to bands. |
BandInterests | String | Band interests. Applicable to bands. |
BandMembers | String | Members of the band. Applicable to bands. |
Bio | String | Biography of the band. Applicable to bands. |
BookingAgent | String | Booking agent of the band. Applicable to bands. |
GeneralManager | String | General manager of the business. Applicable to restaurants or nightlife. Applicable to bands. |
Hometown | String | Hometown of the band. Applicable to bands. |
PressContact | String | Press contact information of the band. Applicable to bands. |
RecordLabel | String | Record label of the band. Applicable to bands. |
Awards | String | Awards information for the film or TV show. Applicable to films and TV shows. |
DirectedBy | String | The director of the film or TV show. Applicable to films and TV shows. |
Genre | String | The genre of the film or TV show. Applicable to films and TV shows. |
Influences | String | Influences on the band. Applicable to bands. |
PlotOutline | String | The plot outline of the film or TV show. Applicable to films and TV shows. |
ProducedBy | String | The productor of the film. Applicable to films. |
ReleaseData | String | The film's release data. Applicable to films and TV shows. |
ScreenplayBy | String | The screenwriter of the film. Applicable to films and TV shows. |
Starring | String | The cast of the film or TV show. Applicable to films and TV shows. |
Studio | String | The studio for the film production. Applicable to films. |
Network | String | The network the TV show airs on. Applicable to TV shows. |
Schedule | String | The air schedule of the TV show. Applicable to TV shows. |
Season | String | The current season of the TV show. Applicable to TV shows. |
WrittenBy | String | The writer of the TV show. Applicable to TV shows. |
Built | String | The information about when the vehicle was built. Applicable to vehicles. |
Features | String | Features of the vehicle. Applicable to vehicles. |
MPG | String | Miles per gallon for the vehicle. Applicable to vehicles. |
Members | String | Members of this org. Applicable to pages representing team orgs. |
InstagramBusinessAccountId | String | The business instagram account id associated with this page. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
offset | String | Which result to begin returning results from. Used for manual paging of results. |
Query the Permissions the User has granted the current application.
Name | Type | Description |
PermissionName [KEY] | String | The name of the permission. |
Status | String | The status of the requested permission. |
Query Photos associated with a Target. Accessing Photo information typically requires the user_photos permission.
Photos in Facebook are photos that are uploaded by a user (for example, to a page) and are part of a photo album.
Note: Due to a deprecation in the Facebook API, queries to the Comments, Photos, Posts, and Videos views where a user profile is either the defined or default target, no longer return data for the following fields:
When querying photos, specify a target. The target represents the user, page, album, or event that photos are being retrieved for. For example:
SELECT * FROM Photos WHERE Target = 'facebook'
If no target is specified, the currently authenticated user will be used as the target.
When querying photos, elements may be retrieved by specifying either the CreatedTime or the UpdatedTime. For example:
SELECT * FROM Photos WHERE Target = 'mytarget' AND CreatedTime >= '1/1/2012' AND CreatedTime <= '10/1/2012'
Name | Type | Description |
ID [KEY] | String | The Id of the photo. |
Target | String | The Id or username of the target you are retrieving posts for or are posting to. This may be an album, event, page, or user. |
FromId | String | Id of the user who uploaded the photo. |
FromName | String | Name of the user who uploaded the photo. |
FromPicture | String | Photo of the user who uploaded the photo. |
FromCategory | String | Category of the user who uploaded the photo. FromCategory may only be retrieved if the other From* fields are not selected. |
Link | String | A link to the photo on Facebook. |
Name | String | The name of the photo. |
Picture | String | A link a thumbnail of the photo. |
Source | String | The source image of the photo. |
Height | Integer | The height of the photo. |
Width | Integer | The width of the photo. |
Position | Integer | The position of the photo in the album. |
Icon | String | A link to the icon Facebook displays when photos are published to the stream. |
PlaceId | String | The Id of the location associated with the post, if any. |
PlaceName | String | The name of the location associated with the post, if any. |
Images | String | An aggregate of four different images for the photo. |
CommentsCount | Integer | The number of comments for the photo. |
LikesCount | Integer | The number of times the photo has been liked. |
CommentsData | String | An aggregate of comments for this photo. |
LikesData | String | An aggregate of likes data. |
CreatedTime | Datetime | When the photo was uploaded. |
UpdatedTime | Datetime | When the photo was last updated. |
Query the Places based on the supplied Id. Places are stored as Pages in Facebook.
Places in Facebook are places that can charted on a map and visited. They will typically contain an address, coordinates, and basic information.
If you know the place Id, you may specify the Id to obtain information about the specific place. For example:
SELECT * FROM Places WHERE Id = '407032649344593'
If no Id is specified, no results will come back.
Name | Type | Description |
ID [KEY] | String | The Id of the place. |
Username | String | Username for the page of the place if any. |
Name | String | The name of the place. |
Category | String | The category of the place. |
Categories | String | An aggregate of categories associated with the page if multiple categories are available. |
Link | String | A link to the place. |
LocationStreet | String | The street address of the place. |
LocationCity | String | The the city for the place. |
LocationState | String | The the state for the place. |
LocationCountry | String | The the country for the place. |
LocationZip | String | The the ZIP code of the place. |
LocationLatitude | String | The latitude of the place. |
LocationLongitude | String | The longitude of the place. |
Phone | String | The phone number of the place, if available. |
Picture | String | A link to the profile picture of the page for the place. |
About | String | Basic information about the place. |
Description | String | A description of the place, if available. |
Website | String | A link to the website for the place. |
Likes | Integer | Number of people who like the place. |
Checkins | Integer | The total number of users who have checked in to the place. |
TalkingAboutCount | Integer | The number of users talking about the place. |
CanPost | Boolean | Boolean indicating if the authenticated user can post of the page for the place. |
IsPublished | Boolean | A boolean indicating if the page for the place has been published. |
IsCommunityPage | Boolean | Boolean indicating if this is a community Page. |
PublicTransit | String | The public transit available for the place, if any. |
ParkingStreet | Boolean | Boolean indicating if street parking is available. |
ParkingLot | Boolean | Boolean indicating if a parking lot is available. |
ParkingValet | Boolean | Boolean indicating if valet parking is available. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
Distance | String | Optional input that can be specified if searching places. This is the maximum distance from the specified LocationLatitude and LocationLongitude in meters. |
offset | String | Which result to begin returning results from. Used for manual paging of results. |
List of ratings for a Facebook Page. This view requires authentication.
Name | Type | Description |
Target | String | The Id or name of the page to retrieve ratings for. |
CreatedTime | Datetime | When the reviewer rated this object. |
HasRating | Boolean | Bolean indicating if there was a rating included? (1-5 stars). |
HasReview | Boolean | Bolean indicating if there was text in the rating. |
OpenGraphID | String | Id of Open Graph story generated by the rating action. |
Rating | Integer | Rating (1-5 stars). |
ReviewText | String | The time the last message was posted in the conversation. |
ReviewerID | String | Person who rated the object. |
ReviewerName | String | Person who rated the object. |
Allows the retrieval of simple video insights with a single value in the response.
Simple video insights refers to simple insights that can be retrieved from a video. These kinds of insights have a single value in the response and can only be filtered by a few values.
When selecting simple video insights, a Target must be specified. In addition, an InsightName should always be specified. For instance:
SELECT * FROM SimpleVideoInsights WHERE Target = 'myvideoid' AND InsightName = 'TOTAL_VIDEO_VIEWS'
Note: Unlike other types of insights, video insights are only available for the entire lifetime of the video. Breakdowns in smaller units are not possible.
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
Value | Long | Insight column for a singular value response. |
Target | String | The target of the insight. This must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: TOTAL_VIDEO_VIEWS, TOTAL_VIDEO_VIEWS_UNIQUE, TOTAL_VIDEO_VIEWS_AUTOPLAYED, TOTAL_VIDEO_VIEWS_CLICKED_TO_PLAY, TOTAL_VIDEO_VIEWS_SOUND_ON, TOTAL_VIDEO_COMPLETE_VIEWS, TOTAL_VIDEO_COMPLETE_VIEWS_UNIQUE, TOTAL_VIDEO_COMPLETE_VIEWS_AUTO_PLAYED, TOTAL_VIDEO_COMPLETE_VIEWS_CLICKED_TO_PLAY, TOTAL_VIDEO_10S_VIEWS, TOTAL_VIDEO_10S_VIEWS_UNIQUE, TOTAL_VIDEO_10S_VIEWS_auto_played, TOTAL_VIDEO_10S_VIEWS_CLICKED_TO_PLAY, TOTAL_VIDEO_10S_VIEWS_SOUND_ON, TOTAL_VIDEO_AVG_TIME_WATCHED, TOTAL_VIDEO_VIEW_TOTAL_TIME, TOTAL_VIDEO_IMPRESSIONS, TOTAL_VIDEO_IMPRESSIONS_UNIQUE, TOTAL_VIDEO_IMPRESSIONS_VIRAL_UNIQUE, TOTAL_VIDEO_IMPRESSIONS_VIRAL, TOTAL_VIDEO_IMPRESSIONS_FAN_UNIQUE, TOTAL_VIDEO_IMPRESSIONS_FAN |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Query attachments from a post or comment.
StoryAttachments in Facebook are attachments associated with a particular user or page story, like a page post or comment.
When querying StoryAttachments, the Target must be specified and set to that of a post or comment. For example, to retrieve all the attachments for a specific post, your SELECT statement could look something like this:
SELECT * FROM StoryAttachments WHERE Target = '15526475270_410830705612736'
Name | Type | Description |
Target | String | The Id or username of the target you are retrieving the wall for. |
Type | String | The type of post. |
Link | String | The link attached to the post. |
Name | String | The name of the link. |
Caption | String | The caption of the link, which appears beneath the link name. |
Description | String | A description of the link, appears beneath the link caption. |
Source | String | A URL to a flash movie or video file embedded within the post. |
ObjectId | String | The Facebook object Id for an uploaded photo or video. |
Query information about Posts, Statuses, Photos, and other entities that have tagged the User or Page. This view is a derivative of the Wall connection where only entries that have tagged the Target User or Page will be returned. In general it is only available for Pages.
Name | Type | Description |
ID [KEY] | String | The Id of the entity that has tagged the user or page. |
Target | String | The Id or username of the user you are retrieving from. |
FromId | String | Id of the user who made the post. |
FromName | String | Name of the user who made the post. |
FromPicture | String | Picture of the user who made the post. |
Message | String | The message of the post or status if available. |
CommentsCount | Integer | The number of comments for the post. |
LikesCount | Integer | The number of times the post has been liked. |
SharesCount | Integer | The number of times the post has been shared. |
CreatedTime | Datetime | When the post was created. |
UpdatedTime | Datetime | When the post was last updated. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
offset | String | Which result to begin returning results from. Used for manual paging of results. |
Returns basic information about the authenticated user.
Users in Facebook are the various user accounts on Facebook.
When selecting users, an Id must be specified. For example:
SELECT * FROM Posts WHERE Id = 'UserId'
If an Id is not specified, the information for the currently logged in user will be returned.
Name | Type | Description |
ID [KEY] | String | The Id of the user. |
Name | String | The full name of the user. |
Picture | String | Picture of the user. |
FirstName | String | The first name of the user. |
MiddleName | String | The middle name of the user. |
LastName | String | The last name of the user. |
Birthday | String | The birthday of the user. Requires the user_birthday permission. |
String | The email address of the user. Requires the email permission. | |
HometownName | String | The hometown name of the user. Requires the user_hometown permission. |
HometownId | String | The hometown name of the user. Requires the user_hometown permission. |
LocationName | String | The current city name of the user. Requires the user_location permission. |
LocationId | String | The current city Id of the user. Requires the user_location permission. |
Allows the retrieval of video insights by story action type.
Video insights by action type refers to video insights that can be retrieved that detail totals for types of stories.
When selecting video insights, a Target must be specified.
SELECT * FROM VideoInsightsByActionType WHERE Target = 'myvideoid'
Note: Unlike other types of insights, video insights are only available for the entire lifetime of the video. Separation into smaller units is not possible.
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
Like | Long | Total likes. |
Comment | Long | Total comments. |
Share | Long | Total shares. |
Target | String | The target of the insight. This is a video and must always be specified. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows the retrieval of video insights by distribution type.
Video insights by reaction type refers to video insights that offer information on views your video got from different distribution sources.
When selecting video insights, a Target must be specified. In addition, an InsightName should always be specified. For instance:
SELECT * FROM VideoInsightsByDistributionType WHERE Target = 'myvideoid' AND InsightName = 'TOTAL_VIDEO_VIEWS_BY_DISTRIBUTION_TYPE'
Note: Unlike other types of insights, video insights are only available for the entire lifetime of the video. Separation into smaller units is not possible.
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
Page_Owned | Long | Views that were owned by the page. |
Shared | Long | Views coming from shares. |
Crossposted | Long | Views coming from posts that were crossposted. |
Target | String | The target of the insight. This is a video and must always be specified. |
InsightName | String | The name of the insight. This must always be specified. The available values are: TOTAL_VIDEO_VIEWS_BY_DISTRIBUTION_TYPE,TOTAL_VIDEO_VIEW_TIME_BY_DISTRIBUTION_TYPE |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Allows the retrieval of video insights by reaction type.
Video insights by reaction type refers to video insights that can be measured by the type of reaction.
When selecting video insights, a Target must be specified. For instance:
SELECT * FROM VideoInsightsByReactionType WHERE Target = 'myvideoid'
Note: Unlike other types of insights, video insights are only available for the entire lifetime of the video. Separation into smaller units is not possible.
Name | Type | Description |
RowNumber [KEY] | Int | The row number of the result. |
Like | Long | Total like reactions. |
Love | Long | Total love reactions. |
Wow | Long | Total wow reactions. |
Haha | Long | Total haha reactions. |
Sorry | Long | Total sorry reactions. |
Anger | Long | Total anger reactions. |
Target | String | The target of the insight. This is a video and must always be specified. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.
Name | Type | Description |
FromDateTime | String | The earliest time for insight data to have been collected. |
ToDateTime | String | The latest time for insight data to have been collected. |
Query Videos from a Target. Normally requires the user_videos permission.
Videos in Facebook are videos that have been uploaded by a user or to a page on Facebook.
Note: Due to a deprecation in the Facebook API, queries to the Comments, Photos, Posts, and Videos views where a user profile is either the defined or default target, no longer return data for the following fields:
When selecting videos, specify a target. The target represents the user or page who uploaded the video. If no target is specified, the currently authenticated user will be used as the target. For example:
SELECT * FROM Videos WHERE Target = 'facebook'
If you know the Id, you can specify the Id to obtain information about the specific video. For example:
SELECT * FROM Videos WHERE Id = 'VideoId'
When querying videos, retrieve elements by specifying either the CreatedTime or the UpdatedTime. For example:
SELECT * FROM Videos WHERE Target = 'mytarget' AND CreatedTime >= '1/1/2012' AND CreatedTime <= '10/1/2012'
Name | Type | Description |
ID [KEY] | String | The Id of the video. |
Target | String | The Id or username of the target you are retrieving videos for. |
FromId | String | Id of the user who uploaded the video. |
FromName | String | Name of the user who uploaded the video. |
FromPicture | String | Picture of the user who uploaded the video. |
FromCategory | String | Category of the user who uploaded the video. FromCategory may only be retrieved if the other From* fields are not selected. |
Description | String | A description of the video. |
Picture | String | URL for the thumbnail of the video. |
Source | String | A URL to the raw, playable video file. |
EmbedHtml | String | The HTML element that may be embedded in an Web page to play the video. |
Icon | String | The icon that Facebook displays when videos are published to the Feed. |
Format | String | An aggregate of four different formats for the video. |
TagsData | String | An aggregate of users tagged in the video, if any. |
CommentsCount | Integer | The number of comments for the video. |
LikesCount | Integer | The number of times the video has been liked. |
CommentsData | String | An aggregate of comments for the video. |
CreatedTime | Datetime | When the video was uploaded. |
UpdatedTime | Datetime | When the video was last updated. |
Query Posts from the Wall of a Target.
Walls in Facebook are a collection of the various posts and updates made to a user's profile or wall.
When selecting from a wall, specify a target. The target represents the user, page, group, application, or other valid entity that may have a wall associated with it. If no target is specified, the currently authenticated user will be used as the target. For example:
SELECT * FROM Wall WHERE Target = 'facebook'
When querying the wall, elements may be retrieved by specifying either the CreatedTime or the UpdatedTime. For example:
SELECT * FROM Wall WHERE Target = 'facebook' AND CreatedTime >= '1/1/2012' AND CreatedTime <= '2/1/2012'
While the wall may not be directly inserted to, you may post to a wall by issuing an INSERT with the correct target using the Posts table.
Name | Type | Description |
ID [KEY] | String | The Id of the post. |
Target | String | The Id or username of the target you are retrieving the wall for. |
FromId | String | Id of the user who made the post. |
FromName | String | Name of the user who made the post. |
FromPicture | String | Picture of the user who made the comment. |
FromCategory | String | Category of the user who made the post. FromCategory may only be retrieved if the other From* fields are not selected. |
ToData | String | An aggregate of users the post was made to. |
Message | String | The message of the post. |
MessageTags | String | An aggregate of objects tagged in the message such as Users, Pages, etc. |
Picture | String | A link to the picture included in the post. |
Icon | String | Link to an icon representing the type of post. |
Actions | String | An aggregate of available actions on the post (such as commenting or liking). |
CommentsCount | Integer | The number of comments for the post. |
LikesCount | Integer | The number of times the post has been liked. |
SharesCount | Integer | The number of times the post has been shared. |
PlaceId | String | The Id of the location associated with the post, if any. |
PlaceName | String | The name of the location associated with the post, if any. |
Attachments | String | An aggregate for the attachments of the post. |
ApplicationId | String | Id of the application this post came from. |
ApplicationNamespace | String | Information about the application used to create the entity. |
Story | String | Text of stories not intentionally generated by users, such as those generated when two users become friends; you must have the 'Include recent activity stories' migration enabled in your app to retrieve these stories. |
StoryTags | String | An aggregate of objects (users, pages, etc.) associated with the story. |
LikesData | String | An aggregate of like data. |
CommentsData | String | An aggregate of comments for this post. |
CreatedTime | Datetime | When the post was created. |
UpdatedTime | Datetime | When the post was last updated. |