Description

This processor is used to get the data from Instagram using API (Application Program Interface).

Tags

Syncfusion, Instagram, get, social media.

Properties

In the following list, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values.

Name

Default Value

Allowable Values

Description

Facebook Host

https://api.instagram.com/v1

Host url of the Instagram API.
API EndPoint Specifies API endpoint used to share the data in Instagram account.
Access token Access token to access an API.

Sensitive Property: true

Relationships

Name

Description

failure The original FlowFile will be routed on any type of connection failure, timeout, or general exception.
success The original FlowFile will be routed upon success (2xx status codes).

Read Attributes

None specified.

Writes Attributes

None specified.

How to create application and generate access token?

The Instagram API requires authentication - specifically requests are made on behalf of a user. Authenticated requests require an “access_token”. Access tokens may expire at any time in the future. The following steps are used to generate an access token:

  • Registering new client
  • Generating access token
  • Fetching data from Instagram

Registering new client

The following steps are used to register a new client in Instagram:

Step 1: Register a new client in Instagram by clicking the “Manage Client” in header of Instagram developer account, Manage Client page will open.

Step 2: Click “Register a New Client” in Manage Client page.

Step 3: Enter the relevant information in Client Registration page and click Register.

Step 4: After the registration process a new client will be created with unique Client Id and Client Secret. This Client Id and Client Secret is used to get the “access_token”.

Generating access token

To generate an access token for accessing the rest API Instagram by the following two ways:

  • Server-Side Authentication
  • Client-Side Authentication

The following steps will describe how to generate access token in both ways.

Step 1: Grant authorization for the application(client) to access the Instagram data. So, navigate to the following link.

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code

The following parameters are used in the link:

Parameters

Description

client_id Id after registering the client. (Register New Client – Step 4)
redirect_uri Application URL used for client registration. (Register New Client – Step 3)
response_type For Server-Side authorization use “code”, for Client-Side authorization use “token”

Step 2: For Server-Side authentication, after the above step it will automatically redirect to redirect URL mentioned in the above API with a code parameter that contains access code used to get access token in the next step.

http://your-redirect-uri?code=CODE

For Client-Side authentication user will receive “access_token” directly in the step by navigating to the redirect URL with token parameter that contains “access_token”. But this Client-Side authentication is less secure.

http://your-redirect-uri#access_token=ACCESS-TOKEN

Step 3: (Only for Server-Side Authentication) Use the access code generated in step 2 to get “access_token”. To generate the access token, the following parameters should be mentioned in the body:

Parameters

Description

client_id Your client id.
client_secret Your client secret.
grant_type currently authorization_code is the only supported value.
redirect_uri The redirect_uri, you used in the authorization request. Note: This must be the same value as in the authorization request.
code The exact code you received in step 2.

After that send a POST request to https://api.instagram.com/oauth/access_token with above mentioned parameters in the body.

You will get a json response which contains the “access_token” as shown as follows,

Now you can access the Instagram API using the access token obtained from the above step.

How to get data from Instagram using Data Integration Platform?

In Data Integration GetInstagram processor is used to share data in the Instagram.

Here is overview template to get data from Instagram and store the response in a file.

Step 1: Drag and drop the GetInstagram processor into the canvas. Double click the processor to configure it.

Select the Endpoint, enter access token generated and response type in which the response data should be retrieved.

Step 2:

Drag and drop the PutFile processor. Double click to configure the processor and enter the Directory in which the response should be stored as follows,