Package com.restfb
Class DefaultInstagramClient
- java.lang.Object
-
- com.restfb.DefaultFacebookClient
-
- com.restfb.DefaultInstagramClient
-
- All Implemented Interfaces:
FacebookClient
@Deprecated public class DefaultInstagramClient extends DefaultFacebookClient
Deprecated.on December 2024 see blog post: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/The default implementation to work with the Instagram Basic Display API.it is used for this Instagram API and for the Threads API. This API is accordingly to the reference based on the Instagram Basic Display API.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.restfb.DefaultFacebookClient
DefaultFacebookClient.Requestor
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
ACCESS_TOKEN_PARAM_NAME
Reserved access token parameter name.protected static String
APP_SECRET_PROOF_PARAM_NAME
Reserved application secret proof parameter name.protected static String
FORMAT_PARAM_NAME
Reserved "result format" parameter name.protected JsonMapper
jsonMapper
Handles mapping Facebook response JSON to Java objects.protected static String
METHOD_PARAM_NAME
Reserved method override parameter name.protected WebRequestor
webRequestor
HandlesGET
s andPOST
s to the Facebook API endpoint.-
Fields inherited from class com.restfb.DefaultFacebookClient
accessToken, accessTokenInHeader, ALGORITHM, apiVersion, APP_ID, APP_SECRET, appSecret, CANNOT_EXTRACT_ACCESS_TOKEN_MESSAGE, CLIENT_ID, CODE, CONNECTION, CONNECTION_TYPE, GRANT_TYPE, httpDeleteFallback, IDS_PARAM_NAME, PARAM_CLIENT_SECRET, PATH_OAUTH_ACCESS_TOKEN, REDIRECT_URI, SCOPE
-
-
Constructor Summary
Constructors Constructor Description DefaultInstagramClient(Version version)
Deprecated.DefaultInstagramClient(String accessToken, Version apiVersion)
Deprecated.DefaultInstagramClient(String accessToken, WebRequestor webRequestor, JsonMapper jsonMapper, Version apiVersion)
Deprecated.DefaultInstagramClient(String accessToken, String appSecret, Version apiVersion)
Deprecated.DefaultInstagramClient(String accessToken, String appSecret, WebRequestor webRequestor, JsonMapper jsonMapper, Version apiVersion)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String
createBaseUrlForEndpoint(String apiCall, boolean hasAttachment, boolean hasReel)
Deprecated.FacebookClient
createClientWithAccessToken(String accessToken)
Deprecated.creates a newFacebookClient
from an old one.String
getLoginDialogUrl(String appId, String redirectUri, ScopeBuilder scope, Parameter... parameters)
Deprecated.generates the login dialog urlString
getLoginDialogUrl(String appId, String redirectUri, ScopeBuilder scope, String state, Parameter... parameters)
Deprecated.generates the login dialog urlAccessToken
obtainExtendedAccessToken(String appId, String appSecret)
Deprecated.Convenience method which invokesFacebookClient.obtainExtendedAccessToken(String, String, String)
with the current access token.AccessToken
obtainExtendedAccessToken(String appId, String appSecret, String accessToken)
Deprecated.Obtains an extended access token for the given existing, non-expired, short-lived access_token.AccessToken
obtainRefreshedExtendedAccessToken()
Deprecated.Obtain a refreshed Instagram extended access token.AccessToken
obtainUserAccessToken(String clientId, String clientSecret, String redirectUri, String code)
Deprecated.Obtains an access token which can be used to perform Graph API operations on behalf of a user.protected Parameter[]
parametersWithAdditionalParameter(Parameter parameter, Parameter... parameters)
Appends the givenparameter
to the givenparameters
array.protected String
urlEncodedValueForParameterName(String name, String value)
Gets the URL-encoded version of the givenvalue
for the parameter namedname
.protected void
verifyParameterLegality(Parameter... parameters)
Verifies that the provided parameter names don't collide with the ones we internally pass along to Facebook.-
Methods inherited from class com.restfb.DefaultFacebookClient
convertSessionKeysToAccessTokens, createEndpointForApiCall, debugToken, deleteObject, executeBatch, executeBatch, executeBatch, fetchConnection, fetchConnectionPage, fetchDeviceCode, fetchObject, fetchObjects, getAccessTokenFromResponse, getFacebookEndpointUrls, getFacebookExceptionGenerator, getFacebookGraphEndpointUrl, getFacebookGraphVideoEndpointUrl, getFacebookReelsUploadEndpointUrl, getGenericLoginDialogUrl, getJsonMapper, getLogoutUrl, getWebRequestor, isHttpDeleteFallback, makeRequest, makeRequest, makeRequest, makeRequestAndProcessResponse, obtainAppAccessToken, obtainAppSecretProof, obtainDeviceAccessToken, parseSignedRequest, publish, publish, publish, publish, setFacebookEndpointUrls, setFacebookExceptionGenerator, setHeaderAuthorization, setHttpDeleteFallback, toParameterString, toParameterString, urlDecodeSignedRequestToken, verifySignedRequest
-
-
-
-
Field Detail
-
webRequestor
protected WebRequestor webRequestor
HandlesGET
s andPOST
s to the Facebook API endpoint.
-
jsonMapper
protected JsonMapper jsonMapper
Handles mapping Facebook response JSON to Java objects.
-
METHOD_PARAM_NAME
protected static final String METHOD_PARAM_NAME
Reserved method override parameter name.- See Also:
- Constant Field Values
-
FORMAT_PARAM_NAME
protected static final String FORMAT_PARAM_NAME
Reserved "result format" parameter name.- See Also:
- Constant Field Values
-
ACCESS_TOKEN_PARAM_NAME
protected static final String ACCESS_TOKEN_PARAM_NAME
Reserved access token parameter name.- See Also:
- Constant Field Values
-
APP_SECRET_PROOF_PARAM_NAME
protected static final String APP_SECRET_PROOF_PARAM_NAME
Reserved application secret proof parameter name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultInstagramClient
public DefaultInstagramClient(Version version)
Deprecated.
-
DefaultInstagramClient
public DefaultInstagramClient(String accessToken, Version apiVersion)
Deprecated.
-
DefaultInstagramClient
public DefaultInstagramClient(String accessToken, String appSecret, Version apiVersion)
Deprecated.
-
DefaultInstagramClient
public DefaultInstagramClient(String accessToken, WebRequestor webRequestor, JsonMapper jsonMapper, Version apiVersion)
Deprecated.
-
DefaultInstagramClient
public DefaultInstagramClient(String accessToken, String appSecret, WebRequestor webRequestor, JsonMapper jsonMapper, Version apiVersion)
Deprecated.
-
-
Method Detail
-
getLoginDialogUrl
public String getLoginDialogUrl(String appId, String redirectUri, ScopeBuilder scope, String state, Parameter... parameters)
Deprecated.Description copied from interface:FacebookClient
generates the login dialog url- Specified by:
getLoginDialogUrl
in interfaceFacebookClient
- Overrides:
getLoginDialogUrl
in classDefaultFacebookClient
- Parameters:
appId
- The ID of your app, found in your app's dashboard.redirectUri
- The URL that you want to redirect the person logging in back to. This URL will capture the response from the Login Dialog. If you are using this in a webview within a desktop app, this must be set tohttps://www.facebook.com/connect/login_success.html
.scope
- List of Permissions to request from the person using your app.state
- The state parameter is used to prevent CSRF attacks.parameters
- List of additional parameters- Returns:
- the login dialog url
-
getLoginDialogUrl
public String getLoginDialogUrl(String appId, String redirectUri, ScopeBuilder scope, Parameter... parameters)
Deprecated.Description copied from interface:FacebookClient
generates the login dialog url- Specified by:
getLoginDialogUrl
in interfaceFacebookClient
- Overrides:
getLoginDialogUrl
in classDefaultFacebookClient
- Parameters:
appId
- The ID of your app, found in your app's dashboard.redirectUri
- The URL that you want to redirect the person logging in back to. This URL will capture the response from the Login Dialog. If you are using this in a webview within a desktop app, this must be set tohttps://www.facebook.com/connect/login_success.html
.scope
- List of Permissions to request from the person using your app.parameters
- List of additional parameters- Returns:
- the login dialog url
-
obtainUserAccessToken
public AccessToken obtainUserAccessToken(String clientId, String clientSecret, String redirectUri, String code)
Deprecated.Description copied from interface:FacebookClient
Obtains an access token which can be used to perform Graph API operations on behalf of a user.See Access Tokens.
- Specified by:
obtainUserAccessToken
in interfaceFacebookClient
- Overrides:
obtainUserAccessToken
in classDefaultFacebookClient
- Parameters:
clientId
- The ID of the app for which you'd like to obtain an access token.clientSecret
- The secret for the app for which you'd like to obtain an access token.redirectUri
- The redirect URI which was used to obtain theverificationCode
.code
- The verification code in the Graph API callback to the redirect URI.- Returns:
- The access token for the user identified by
appId
,appSecret
,redirectUri
andverificationCode
. - See Also:
FacebookClient.obtainUserAccessToken(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
-
obtainExtendedAccessToken
public AccessToken obtainExtendedAccessToken(String appId, String appSecret, String accessToken)
Deprecated.Description copied from interface:FacebookClient
Obtains an extended access token for the given existing, non-expired, short-lived access_token.- Specified by:
obtainExtendedAccessToken
in interfaceFacebookClient
- Overrides:
obtainExtendedAccessToken
in classDefaultFacebookClient
- Parameters:
appId
- The ID of the app for which you'd like to obtain an extended access token.appSecret
- The secret for the app for which you'd like to obtain an extended access token.accessToken
- The non-expired, short-lived access token to extend.- Returns:
- An extended access token for the given
accessToken
. - See Also:
FacebookClient.obtainExtendedAccessToken(java.lang.String, java.lang.String, java.lang.String)
-
obtainExtendedAccessToken
public AccessToken obtainExtendedAccessToken(String appId, String appSecret)
Deprecated.Description copied from interface:FacebookClient
Convenience method which invokesFacebookClient.obtainExtendedAccessToken(String, String, String)
with the current access token.- Specified by:
obtainExtendedAccessToken
in interfaceFacebookClient
- Overrides:
obtainExtendedAccessToken
in classDefaultFacebookClient
- Parameters:
appId
- The ID of the app for which you'd like to obtain an extended access token.appSecret
- The secret for the app for which you'd like to obtain an extended access token.- Returns:
- An extended access token for the given
accessToken
. - See Also:
FacebookClient.obtainExtendedAccessToken(java.lang.String, java.lang.String)
-
obtainRefreshedExtendedAccessToken
public AccessToken obtainRefreshedExtendedAccessToken()
Deprecated.Obtain a refreshed Instagram extended access token.This method is used to refresh an existing Instagram extended access token. Extended access tokens expire after a certain period of time, and this method allows you to obtain a new one using the refresh token provided with the original extended access token.
- Specified by:
obtainRefreshedExtendedAccessToken
in interfaceFacebookClient
- Overrides:
obtainRefreshedExtendedAccessToken
in classDefaultFacebookClient
- Returns:
- A new
AccessToken
object containing the refreshed access token, expiration time, and token type. - Throws:
FacebookResponseContentException
- If the response from the Facebook API cannot be parsed or if the access token cannot be extracted from the response.
-
createClientWithAccessToken
public FacebookClient createClientWithAccessToken(String accessToken)
Deprecated.Description copied from interface:FacebookClient
creates a newFacebookClient
from an old one.App secret and api version are taken from the original client.
- Specified by:
createClientWithAccessToken
in interfaceFacebookClient
- Overrides:
createClientWithAccessToken
in classDefaultFacebookClient
- Parameters:
accessToken
- this accesstoken is used for the new client- Returns:
- a new Facebookclient
-
createBaseUrlForEndpoint
protected String createBaseUrlForEndpoint(String apiCall, boolean hasAttachment, boolean hasReel)
Deprecated.- Overrides:
createBaseUrlForEndpoint
in classDefaultFacebookClient
-
parametersWithAdditionalParameter
protected Parameter[] parametersWithAdditionalParameter(Parameter parameter, Parameter... parameters)
Appends the givenparameter
to the givenparameters
array.- Parameters:
parameter
- The parameter value to append.parameters
- The parameters to which the givenparameter
is appended.- Returns:
- A new array which contains both
parameter
andparameters
.
-
urlEncodedValueForParameterName
protected String urlEncodedValueForParameterName(String name, String value)
Gets the URL-encoded version of the givenvalue
for the parameter namedname
.Includes special-case handling for access token parameters where we check if the token is already URL-encoded - if so, we don't encode again. All other parameter types are always URL-encoded.
- Parameters:
name
- The name of the parameter whose value should be URL-encoded and returned.value
- The value of the parameter which should be URL-encoded and returned.- Returns:
- The URL-encoded version of the given
value
.
-
verifyParameterLegality
protected void verifyParameterLegality(Parameter... parameters)
Verifies that the provided parameter names don't collide with the ones we internally pass along to Facebook.- Parameters:
parameters
- The parameters to check.- Throws:
IllegalArgumentException
- If there's a parameter name collision.
-
-