This repository has been archived by the owner on Oct 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Data Retrieval
Ander Goig edited this page Oct 14, 2018
·
11 revisions
IMPORTANT: Most of the endpoints have been deprecated by Instagram and are no longer available. See the full list here.
All of the following functions are very similar and straightforward, here's an example of retrieving recent media:
let api = Instagram.shared
api.recentMedia(fromUser: "self", count: 5, success: { mediaList in
// Do your stuff here ...
}, failure: { error in
print(error.localizedDescription)
})
User Endpoints - SwiftInstagram docs - Official docs
/// Get information about a user (use "self" to reference the currently authenticated user).
api.user(_ userId: String, success: SuccessHandler<InstagramUser>?, failure: FailureHandler?)
/// Get the most recent media published by a user (use "self" to reference the currently authenticated user).
api.recentMedia(fromUser userId: String, maxId: String? = nil, minId: String? = nil, count: Int? = nil, success: SuccessHandler<[InstagramMedia]>?, failure: FailureHandler?)
/// Get the list of recent media liked by the currently authenticated user.
api.userLikedMedia(maxLikeId: String? = nil, count: Int? = nil, success: SuccessHandler<[InstagramMedia]>?, failure: FailureHandler?)
/// Get a list of users matching the query.
api.search(user query: String, count: Int? = nil, success: SuccessHandler<[InstagramUser]>?, failure: FailureHandler?)
Relationship Endpoints - SwiftInstagram docs - Official docs
/// Get the list of users this user follows.
api.userFollows(success: SuccessHandler<[InstagramUser]>?, failure: FailureHandler?)
/// Get the list of users this user is followed by.
api.userFollowers(success: SuccessHandler<[InstagramUser]>?, failure: FailureHandler?)
/// List the users who have requested this user's permission to follow.
api.userRequestedBy(success: SuccessHandler<[InstagramUser]>?, failure: FailureHandler?)
/// Get information about a relationship to another user.
api.userRelationship(withUser userId: String, success: SuccessHandler<InstagramRelationship>?, failure: FailureHandler?)
/// Follows the target user.
api.follow(user userId: String, success: SuccessHandler<InstagramRelationship>?, failure: FailureHandler?)
/// Unfollows the target user.
api.unfollow(user userId: String, success: SuccessHandler<InstagramRelationship>?, failure: FailureHandler?)
/// Approve the target user's request.
api.approveRequest(fromUser userId: String, success: SuccessHandler<InstagramRelationship>?, failure: FailureHandler?)
/// Ignore the target user's request.
api.ignoreRequest(fromUser userId: String, success: SuccessHandler<InstagramRelationship>?, failure: FailureHandler?)
Media Endpoints - SwiftInstagram docs - Official docs
/// Get information about a media object.
api.media(withId id: String, success: SuccessHandler<InstagramMedia>?, failure: FailureHandler?)
/// Get information about a media object.
api.media(withShortcode shortcode: String, success: SuccessHandler<InstagramMedia>?, failure: FailureHandler?)
/// Search for recent media in a given area (with latitude and longitude).
api.searchMedia(lat: Double? = nil, lng: Double? = nil, distance: Int? = nil, success: SuccessHandler<[InstagramMedia]>?, failure: FailureHandler?)
/// Search for recent media in a given area (with coordinates).
api.searchMedia(coordinates: CLLocationCoordinate2D? = nil, distance: Int? = nil, success: SuccessHandler<[InstagramMedia]>?, failure: FailureHandler?)
Comment Endpoints - SwiftInstagram docs - Official docs
/// Get a list of recent comments on a media object.
api.comments(fromMedia mediaId: String, success: SuccessHandler<[InstagramComment]>?, failure: FailureHandler?)
/// Create a comment on a media object.
api.createComment(onMedia mediaId: String, text: String, success: SuccessHandler<InstagramComment>?, failure: FailureHandler?)
/// Remove a comment either on the authenticated user's media object or authored by the authenticated user.
api.deleteComment(_ commentId: String, onMedia mediaId: String, success: EmptySuccessHandler?, failure: FailureHandler?)
Like Endpoints - SwiftInstagram docs - Official docs
/// Get a list of users who have liked this media.
api.likes(inMedia mediaId: String, success: SuccessHandler<[InstagramUser]>?, failure: FailureHandler?)
/// Set a like on this media by the currently authenticated user.
api.like(media mediaId: String, success: EmptySuccessHandler?, failure: FailureHandler?)
/// Remove a like on this media by the currently authenticated user.
api.unlike(media mediaId: String, success: EmptySuccessHandler?, failure: FailureHandler?)
Tag Endpoints - SwiftInstagram docs - Official docs
/// Get information about a tag object.
api.tag(_ tagName: String, success: SuccessHandler<InstagramTag>?, failure: FailureHandler?)
/// Get a list of recently tagged media.
api.recentMedia(withTag tagName: String, maxTagId: String? = nil, minTagId: String? = nil, count: Int? = nil, success: SuccessHandler<[InstagramMedia]>?, failure: FailureHandler?)
/// Search for tags by name.
api.search(tag query: String, success: SuccessHandler<[InstagramTag]>?, failure: FailureHandler?)
Location Endpoints - SwiftInstagram docs - Official docs
/// Get information about a location.
api.location(_ locationId: String, success: SuccessHandler<InstagramLocation>?, failure: FailureHandler?)
/// Get a list of recent media objects from a given location.
api.recentMedia(forLocation locationId: String, maxId: String? = nil, minId: String? = nil, success: SuccessHandler<[InstagramMedia]>?, failure: FailureHandler?)
/// Search for a location by geographic coordinate (with latitude and longitude).
api.searchLocation(latitude: Double? = nil, longitude: Double? = nil, distance: Int? = nil, facebookPlacesId: String? = nil, success: SuccessHandler<[InstagramLocation<String>]>?, failure: FailureHandler?)
/// Search for a location by geographic coordinate.
api.searchLocation(coordinates: CLLocationCoordinate2D? = nil, distance: Int? = nil, facebookPlacesId: String? = nil, success: SuccessHandler<[InstagramLocation<String>]>?, failure: FailureHandler?)