SocialMiner Forums

« Back to Technical Discussion

RE: Trouble with get follow Twitter Reply API

Combination View Flat View Tree View
Threads [ Previous | Next ]
Whenever I GET the get follow api it returns 405 Method Not Allowed.  The reply says POST and OPTIONS are allowed, but the API doc says you're suppose to GET when querying to see if user a is following user b.
 
 
Here is the url being used...
 
GET (doesn't work)
http://<host>/ccp-webapp/ccp/reply/twitter/follow?user_a=<usera>&user_b=<userb>&account_user=<usera>
 
I've tried with and without the account_user parameter, but still receive the same 405 error code.  I'm able to POST using the URL to follow a new user, just not query for an existing follow relationship.
 
POST (works)
http://<host>/ccp-webapp/ccp/reply/twitter/follow?account_user=<usera>&user_to_follow=<userb>
 
thanks,
Brett

Hi Brett,
 
We have an error in our documentation. The method and URL to determine if one user is following another is as follows:
 
Method: GET
URL: http://<host>/ccp-webapp/ccp/reply/twitter/friendships/exists?user_a=<usera>&user_b=<userb>&account_user=<account_user>
 
I'm sorry for the inconvenience.
 
-Mark
 
Whenever I GET the get follow api it returns 405 Method Not Allowed.  The reply says POST and OPTIONS are allowed, but the API doc says you're suppose to GET when querying to see if user a is following user b.
 
 
Here is the url being used...
 
GET (doesn't work)
http://<host>/ccp-webapp/ccp/reply/twitter/follow?user_a=<usera>&user_b=<userb>&account_user=<usera>
 
I've tried with and without the account_user parameter, but still receive the same 405 error code.  I'm able to POST using the URL to follow a new user, just not query for an existing follow relationship.
 
POST (works)
http://<host>/ccp-webapp/ccp/reply/twitter/follow?account_user=<usera>&user_to_follow=<userb>
 
thanks,
Brett

Method: GET
URL: http://<host>/ccp-webapp/ccp/reply/twitter/friendships/exists?user_a=<usera>&user_b=<userb>&account_user=<account_user>

 
I tried the new url, but it seems to be working only when user_a is following user_b.   In this case it returns the expected response and indicates that user_a is indeed following user_b
 

<TwitterProgress>
  <httpResponseCode>200</httpResponseCode>
  <httpResponseMessage>OK</httpResponseMessage>
  <progress>SUCCEEDED</progress>
  <rateLimited>false</rateLimited>
  <twitterStatus>
    <friends>true</friends>
  </twitterStatus>
</TwitterProgress>

 
However, if I try the same thing where user_a isn't following user_b I get back a response that indicates an error.  
 

<TwitterProgress>
  <httpResponseCode>403</httpResponseCode>
  <httpResponseMessage>Forbidden</httpResponseMessage>
  <progress>FAILED</progress>
  <rateLimited>false</rateLimited>
</TwitterProgress>

 
I was expecting the request to succeed, but the friends element value to be false.    Am I interpreting the API correctly?
 
thanks,
Brett Bandy

Hi Brett,

You are interpreting the API correctly.

It is possible that there is something subtle going on here. Is it possible that the users in the request are protected users? There are some notes on the following Twitter API page.

http://dev.twitter.com/doc/get/friendships/exists

Take the following scenario:

usera: protected
userb: protected
usera follows userb
userb does not follow usera

The following request:

http://<host>/ccp-webapp/ccp/reply/twitter/friendships/exists?user_a=usera&user_b=userb&account_user=usera

will succeed (return true in the friends field of the progress message) because usera is following userb.

This request:

http://<host>/ccp-webapp/ccp/reply/twitter/friendships/exists?user_a=userb&user_b=usera&account_user=userb

will fail (return 403 in the httpResponseCode in the progress message) because userb is not following usera.

If you modify the request to the following:

http://<host>/ccp-webapp/ccp/reply/twitter/friendships/exists?user_a=userb&user_b=usera&account_user=usera

The request will succeed, and false will be returned in the friends field.

Please let me know if this matches your scenario. My testing with this scenario yielded the same results as what you saw in your tests.

-Mark

Is it possible that the users in the request are protected users?

 
Yup, you nailed it!   One of the users I was testing with is a protected user.  Once I started using a different user, not being followed, I received a successful response with friends = false.
 
thanks,
Brett Bandy
 

Search CDN

 Go

By API/SDK: