add/search for friends

ok, so doing that will create a user with this info when friends.getAll() is called:

{

 [updated_at] => “2013-05-01T10:13:02+00:00”

[_id] => “5180eaae2bef5ae43600000e”

[friend_id] => “517b81acc58f8ae5a8000002”

[created_at] => “2013-05-01T10:13:02+00:00”

[user_id] => “517b81acc58f8ae5a8000002”

 }

to remove this user from my list, what do I need to pass into friends.remove( friendID)?

Hi,

So the idea is now that user is a ‘friend’ so to remove them, you pass :

[friend_id] => “517b81acc58f8ae5a8000002”

Thanks

-Mohamed

thats when I get the “Friend id is not sent with request” error

granted some of the users on my list isnt real users because they were added by just putting any name into the friend.add() function. but they all get the same info in them. But they wont disapere from the list and all get the same error.

this is the output: (I xed  the auth_tokens)

Corona Cloud: – DELETE Call —

Corona Cloud: Delete URL: https://api.coronalabs.com

Corona Cloud: Delete Path: friends.json

Corona Cloud: Delete Parameters: auth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&user_id=5180eaae2bef5ae43600000e

Corona Cloud: ----------------

Corona Cloud: 

Delete Request: https://api.coronalabs.com/friends.json?auth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&user_id=5180eaae2bef5ae43600000e

Corona Cloud: Friend Deleted: Friend id is not sent with request

Friends:     Friend id is not sent with request

Ok, I see why :slight_smile:

It seems that for some reason the wrong parameter is being sent; it looks like you are sending user_id, instead it should be friend_id.

So your call should look like this:

https://api.coronalabs.com/friends.json?auth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&friend_id=5180eaae2bef5ae43600000e

Thanks

-Mohamed

no, its just that the user_id is the same as friend_id in that instance since the user is me. I am my own best friend I guess you could say :smiley: but the results are the same with all other “friends” I have on the list. Sorry if I was abit confusing with the example I chose to delete.

thanks for the quick replys by the way :slight_smile:

Hehe :slight_smile:

What I was pointing out is not the actually value of the ID, but rather the parameter name.

In the command you showed you posted it has the parameter ‘user_id’, thats incorrect, you need to pass ‘friend_id’.

Even if you are adding yourself, you still need to use friend_id. The idea is now these users in your friend lists are ‘friends’, so to identify them you need to pass ‘friend_id’.

You see what I mean?

-Mohamed

Just to follow up, it looks like the initial corona-cloud-core.lua file is passing the wrong parameter name.

I would suggest you can either:

  1. update to the new lib https://github.com/coronalabs/framework-cloud

or

  1. you can fix the current one;

Line (1051) 

Change from: params = params…"&user_id="…friendID  to: params = params…"&friend_id="…friendID

Thanks

-Mohamed

aha, that did the trick indeed :slight_smile: thanks alot!

also, I see now that I need to get the userprofile of each one in order to get their username… would it be possible to add the username to the information retrived by friends.getAll()? so we dont have to go and do an extra operation in order to get the username? Or is there an easier way than cloud.getProfile( friend_id ) -> then pick out the username from the event.response ? Just would seem logical to display friends by names and not ids :slight_smile:

thanks again for the help!

I’ve added this request to be reviewed by the team.

Thanks

-Mohamed

awesome, thanks :slight_smile:

You guys did a great job of describing the management of friends. Is there any chance that managing friends sample code will be added into gameNetwork_Sample? Thanks… Steve

SCRATCH THAT - there is a friends option you just need to enable it in the sample code. Add a 6th option and button in the main screen and you are off…

SCRATCH THAT - there is a friends option you just need to enable it in the sample code.  Add a 6th option and button in the main screen and you are off…

I am missing something here… Can you let me know what you did from the Corona code perspective to get Friends Management going… Friend button is fine but I guess I am missing something basic…

You guys did a great job of describing the management of friends. Is there any chance that managing friends sample code will be added into gameNetwork_Sample? Thanks… Steve

SCRATCH THAT - there is a friends option you just need to enable it in the sample code. Add a 6th option and button in the main screen and you are off…

SCRATCH THAT - there is a friends option you just need to enable it in the sample code.  Add a 6th option and button in the main screen and you are off…

I am missing something here… Can you let me know what you did from the Corona code perspective to get Friends Management going… Friend button is fine but I guess I am missing something basic…