Comments (19)
im trying to write this but im having a hell of a time getting the methods working and im not sure what im bumping up against. more specifically im trying to follow a user via a post command. i added the relationships permission, ive written this method:
- (void)followUser:(InstagramUser*)user
withSuccess:(void (^)(void))success
failure:(void (^)(NSError* error))failure
{
NSDictionary *params = [NSDictionary dictionaryWithObjects:@[@"action=follow"] forKeys:@[kText]];
[self postPath:[NSString stringWithFormat:@"users/%@/relationships",user.Id] parameters:params responseModel:nil success:^{
success();
} failure:^(NSError *error, NSInteger statusCode) {
failure(error);
NSLog(@"%@", [error description]);
}];
}
I've been able to get it to work on the api console on the instagram dev website but im not understanding this. are you sure the post works for comments even after the persission is granted via email request?
from instagramkit.
this is what i get:
Error Domain=AFNetworkingErrorDomain Code=-1011 "Request failed: not found (404)" UserInfo=0xa949650 {NSErrorFailingURLKey=https://api.instagram.com/v1/users/602138059/relationships, NSLocalizedDescription=Request failed: not found (404), NSUnderlyingError=0xa96eb40 "Request failed: unacceptable content-type: text/html", AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0xa941e80> { URL: https://api.instagram.com/v1/users/602138059/relationships } { status code: 404, headers {
"Cache-Control" = "private, no-cache, no-store, must-revalidate";
Connection = "keep-alive";
"Content-Encoding" = gzip;
"Content-Language" = en;
"Content-Type" = "text/html";
Date = "Fri, 28 Mar 2014 20:34:27 GMT";
Expires = "Sat, 01 Jan 2000 00:00:00 GMT";
Pragma = "no-cache";
Server = nginx;
"Transfer-Encoding" = Identity;
Vary = "Accept-Language, Cookie";
"X-Frame-Options" = SAMEORIGIN;
} }}
from instagramkit.
I've not tested posting comments, but the post call does work in case of Likes.
I did face issues constructing the html body for the post requests.
As it turned out, I was trying to set the Request Serializer to AFJSONRequestSerializer.
self.operationManager.requestSerializer = [[AFJSONRequestSerializer alloc] init];
This caused it to create an json request body, whereas this property should have just been left alone to the default.
Please make sure you're NOT altering the default requestSerializer property.
from instagramkit.
Please fork this repo and commit your code into your fork. I can get it up and running and merge it with the main repo.
from instagramkit.
hey im not great with git, but i think i sent the right thing as a pull request. let me know i can try again.
from instagramkit.
Also, a lot of code has changed in the past couple of hours. Drastic changes to the Engine signatures to incorporate paging. Please use the latest code on master.
from instagramkit.
yes i agree the post call works in likes but i think there is something different about the relationship posting stuff, i think you may have to pass a json string or something. I used the instagram api console to do some testing :
http://instagram.com/developer/api-console/
from instagramkit.
I sent you an invite via skype
from instagramkit.
nickthedude, have you made follow api work?
from instagramkit.
@wenwuwang no i haven't :( I think the request needs to be in JSON format, but im not sure.
from instagramkit.
HI I am getting same error
omain=AFNetworkingErrorDomain Code=-1011 "Request failed: bad request (400)" UserInfo=0xd5184f0 {NSErrorFailingURLKey=https://api.instagram.com/v1/users/281156948/relationship, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0xd297010> { URL: https://api.instagram.com/v1/users/281156948/relationship } { status code: 400, headers {
"Cache-Control" = "private, no-cache, no-store, must-revalidate";
Connection = "keep-alive";
"Content-Language" = en;
"Content-Length" = 282;
"Content-Type" = "application/json; charset=utf-8";
Date = "Fri, 25 Apr 2014 05:45:16 GMT";
Expires = "Sat, 01 Jan 2000 00:00:00 GMT";
Pragma = "no-cache";
Server = nginx;
"Set-Cookie" = "csrftoken=684ad3a65af51c97585d3ea98d175b6b; expires=Fri, 24-Apr-2015 05:45:16 GMT; Max-Age=31449600; Path=/";
Vary = "Cookie, Accept-Language";
"X-Ratelimit-Limit" = 5000;
"X-Ratelimit-Remaining" = 4980;
} }, NSLocalizedDescription=Request failed: bad request (400)}
from instagramkit.
i am also getting same error when we give parameters in NSDictionary.
There is some problem in post request with parameters.
Error Domain=AFNetworkingErrorDomain Code=-1011 "Request failed: bad request (400)" UserInfo=0x17686810 {NSErrorFailingURLKey=https://api.instagram.com/v1/users/31292250/relationship, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x176a49d0> { URL: https://api.instagram.com/v1/users/31292250/relationship } { status code: 400, headers {
"Cache-Control" = "private, no-cache, no-store, must-revalidate";
Connection = "keep-alive";
"Content-Language" = en;
"Content-Type" = "application/json; charset=utf-8";
Date = "Tue, 13 May 2014 13:13:22 GMT";
Expires = "Sat, 01 Jan 2000 00:00:00 GMT";
Pragma = "no-cache";
Server = nginx;
"Set-Cookie" = "csrftoken=e7894bcc14d4e059659de7d4c4730944; expires=Tue, 12-May-2015 13:13:22 GMT; Max-Age=31449600; Path=/";
"Transfer-Encoding" = Identity;
Vary = "Cookie, Accept-Language";
} }, NSLocalizedDescription=Request failed: bad request (400)}
from instagramkit.
@shyambhat @nickthedude @iphonejaha @wenwuwang has anyone already found a solution?
from instagramkit.
this has something to do with the scope
follow/unfollow must be included in the scope
from instagramkit.
It took me less than 10 mins to implement these simple endpoints. Check out the implementation in the "relationships" branch.
Will merge to master and release in the next version shortly.
from instagramkit.
I tried to tell you I sucked, lol. Thanks for fixing this dude. Next time you're In sf I owe you a beer. :)
from instagramkit.
I've just downloaded from git, launched demo, but it still doesn't work (like fails with the same error) :(
from instagramkit.
Is there any solution to this problem? I get the exact same error even for basic requests like "getSelfFeed"
from instagramkit.
@v0l0d you missed read Readme, maybe?
For your app to POST or DELETE likes, comments or follows, you must apply to Instagram here : https://www.facebook.com/help/instagram/contact/185819881608116#
@driver733 try re-authenticating.
from instagramkit.
Related Issues (20)
- Followers list always returns a 0-element array
- Version? HOT 3
- Deprecated methods HOT 2
- Need fix InstagramUser.m HOT 3
- Need for api endpoint for IGTV
- Objective-C for Swift HOT 1
- Instagram getSelfUserDetails bad request 400 eventhough session is valid HOT 2
- My app with istagramkit is opened when I click on another app
- duplicate symbol _kLocation
- UIwebview depecrated HOT 1
- How can I get the 10 most popular user publications in a certain time?
- Instagram Display API HOT 1
- [question] instagram fingerprint
- Login Flow issue
- you are not a sand box user error
- Yehe
- Hi HOT 1
- My work
- https://github.com/eggyo HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instagramkit.