Working with Likes in Instagram

This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Likes in Instagram


[ Overview ] [ Operation details ] [ Sample configuration ]


Overview

The following operations allow you to work with likes in Instagram.Click an operation name to see details on how to use it. For sample proxy service which illustrates how to deal with likes, see  Sample configuration .

Operation

Description

Operation

Description

getMediaLike

Retrieves a list of users who have liked this media.

setMediaLike

Set a like on this media by the currently authenticated user.

deleteMediaLike

Removes a like on this media by the currently authenticated user.

Operation in details

This section provides further details on the operations related to Likes.

Retrieving Media Likes    

The setMediaLike  operation is used to retrieve  a list of users who have liked this media.  Media ID is needed for this operation.

getMediaLike
<instagram.getMediaLike> <mediaId>{$ctx:mediaId}</mediaId> </instagram.getMediaLike>
Properties
  • mediaId  : Specifies the Media  id.

Sample request

Following is a sample request that can be handled by the setMediaLike operation.

Sample Request for getMediaLike
{ "apiUrl":"https://api.instagram.com/v1", "access_token":"1392352686.f59def8.8093ea32008743cb8f4275eb20c5423d", "mediaId":"3" }
Related API documentation

http://instagram.com/developer/endpoints/likes/#get_media_likes

The getMediaLike operation is used to  set likes on a  media by the currently authenticated user.  Media ID is needed for this operation.

setMediaLike
<instagram.setMediaLike> <mediaId>{$ctx:mediaId}</mediaId> </instagram.setMediaLike>
Properties  
Sample request

Following is a sample request that can be handled by the  getMediaLike  operation.

Sample Request for setMediaLike
{ "apiUrl":"https://api.instagram.com/v1", "access_token":"1392352686.f59def8.8093ea32008743cb8f4275eb20c5423d", "mediaId":"3" }
Related API documentation

http://instagram.com/developer/endpoints/likes/#post_likes

Delete Media Like

The deleteMediaLike operation is used to remove a like on this media by the currently authenticated user.  Media ID is needed for this operation.

deleteMediaLike
<instagram.deleteMediaLike> <mediaId>{$ctx:mediaId}</mediaId> </instagram.deleteMediaLike>
Properties  
Sample request

Following is a sample request that can be handled by the  deleteMediaLike  operation.

Sample Request for deleteMediaLike
{ "apiUrl":"https://api.instagram.com/v1", "access_token":"1392352686.f59def8.8093ea32008743cb8f4275eb20c5423d", "mediaId":"3" }
Related API documentation

https://instagram.com/developer/endpoints/likes/#delete_likes

Sample configuration

Following is a sample proxy service that illustrates how to connect to Instagram and use the setMediaLike operation. The sample request for this proxy can be found in Sample Request for setMediaLike. You can use this sample as a template for using other operations in this category.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse" name="setMediaLike" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="mediaId" expression="json-eval($.mediaId)"/> <instagram.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <accessToken>{$ctx:accessToken}</accessToken> </instagram.init> <instagram.setMediaLike> <mediaId>{$ctx:mediaId}</mediaId> </instagram.setMediaLike> <respond/> </inSequence> <outSequence> <log/> <send/> </outSequence> </target> <description/> </proxy>