Hi --

The follow parameter (turning device notifications on or off)  in
friendships/create is not behaving as I expected. It appears that
having the follow parameter in the post data turns device
notifications on, no matter what value you give it.  My (php) code was
this:

public function createFriendship($id = null, $user_id = null,
$screen_name = null, $follow = false){
          //....code deleted for clarity....
        $params["follow"] = $follow;
        return $this->makeAPIRequest("http://twitter.com/friendships/
create.json",$params,"POST","TwitterAPIUser");
}

Calling createFriendship(null, null, "chriscarson") would, after php
converts false into an empty string, result in post data like this...

screen_name=chriscarson&follow=

I expected the API to interpret the null "follow" value as false, but
I think it interprets the presence of "follow" as true, without
checking the value.

Anyway, I fixed by  doing this...

 if ($follow) $params["follow"] = $follow;

This results in post data ...

screen_name=chriscarson

This seems to be working.  But maybe it'd be a good idea to clarify
the expected values for boolean post parameters.  Thanks,

--Chris



On Apr 22, 8:36 pm, Eric Blair <eric.s.bl...@gmail.com> wrote:
> Damn. That was it. Thanks for the pointer.
>
> --Eric
>
> On Apr 22, 2009, at 7:58 PM, Matt Sanford wrote:
>
>
>
> > Hi Eric,
>
> >    If you do a friendships/create?follow=true is will turn on  
> > notifications when the follower is added. Poorly namedparameter, I  
> > know.
>
> > — Matt
>
> > On Apr 22, 2009, at 04:31 PM, Eric Blair wrote:
>
> >> Is there any condition that would result in device notification  
> >> being active immediately after following somebody via friendship/
> >> create? I have a user who's telling me they're getting SMS updates  
> >> from new friends and following them in my app, but I don't see  
> >> anything in my logs indicating the I called /notifications/follow.
>
> >> I've looked through the API docs and the settings on Twitter and  
> >> nothing's jumped out at me.
>
> >> Thanks,
> >> --Eric

Reply via email to