Git Product home page Git Product logo

Comments (19)

nickthedude avatar nickthedude commented on May 24, 2024

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.

nickthedude avatar nickthedude commented on May 24, 2024

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.

shyambhat avatar shyambhat commented on May 24, 2024

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.

shyambhat avatar shyambhat commented on May 24, 2024

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.

nickthedude avatar nickthedude commented on May 24, 2024

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.

shyambhat avatar shyambhat commented on May 24, 2024

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.

nickthedude avatar nickthedude commented on May 24, 2024

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 :
screen shot 2014-03-28 at 2 45 36 pm

http://instagram.com/developer/api-console/

from instagramkit.

nickthedude avatar nickthedude commented on May 24, 2024

I sent you an invite via skype

from instagramkit.

wenwuwang avatar wenwuwang commented on May 24, 2024

nickthedude, have you made follow api work?

from instagramkit.

nickthedude avatar nickthedude commented on May 24, 2024

@wenwuwang no i haven't :( I think the request needs to be in JSON format, but im not sure.

from instagramkit.

buddyhut avatar buddyhut commented on May 24, 2024

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.

jaharabari avatar jaharabari commented on May 24, 2024

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.

fabf98dev avatar fabf98dev commented on May 24, 2024

@shyambhat @nickthedude @iphonejaha @wenwuwang has anyone already found a solution?

from instagramkit.

IngenieurinW avatar IngenieurinW commented on May 24, 2024

this has something to do with the scope
follow/unfollow must be included in the scope

from instagramkit.

shyambhat avatar shyambhat commented on May 24, 2024

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.

nickthedude avatar nickthedude commented on May 24, 2024

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.

v0l0d avatar v0l0d commented on May 24, 2024

I've just downloaded from git, launched demo, but it still doesn't work (like fails with the same error) :(

from instagramkit.

driver733 avatar driver733 commented on May 24, 2024

Is there any solution to this problem? I get the exact same error even for basic requests like "getSelfFeed"

from instagramkit.

shyambhat avatar shyambhat commented on May 24, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.