Ning Developer Network

Owen Winkler

How do I get a member listing?

I've been struggling on and off for a few days trying to work with the REST interface to embed a list of members of my network along with their profile photos into an external site.

It seems like I should be able to obtain a list of members using this REST url:

https://rockriverstar.ning.com/xn/atom/1.0/content(type='Users')?order=createdDate@D

But this URL returns no results when I know there are several.

Reading some threads in the forum, it seems that I may need to authenticate to Ning to obtain this listing. This is not a problem as I intend to obtain the listing via PHP on my server and cache it for a while anyway. But basing my code on the sample code I found here, I have been unable to obtain a list of members of my network:

http://restdemos.ning.com/code.php

I have tried using curl to connect to Ning with CURLOPT_USERPWD on a GET request of the URL above, but I get the same empty results. Only when I try to publish new content to the network does the authentication seem to do anything.

Can someone please point me to some sample code in PHP that does what I want? It seems like listing members would be a pretty common task. If that's not available, are there any hints or documentation of how to get (not insert) "private" data like a member listing from the network using PHP?

Thanks,
Owen Winkler

Tags: api, atom, auth, http, member, php, private, rest

Reply to This

Replies to This Discussion

Replace (type='Users') with (type='User').

Reply to This

I am doing something similar. I suggest you look at the Wordpress Ning authentication plugin (can be found somewhere on these forums).

There are basically 3 Curl calls:
1. to authenticate your user
2. to authenticate yourself as the administrator
3. to pull the profile information about your user

You can throw out part #1, and modify part #3 by taking out email=$user_email - then it will just pull all users in your network.

Reply to This

Thanks for the reply. I did get things working a bit more smoothly with a single curl call, but I will look into the WP plugin just to see if what I'm doing is kosher.

Thanks again.

Reply to This

Glad you got it to work. Would you mind sharing what you did?

Reply to This

Hello Owen!

Cool avatar :)

You may want to check out this tutorial. It describes how to fetch other private objects using the REST APIs. It can be adapted pretty easily to fetch a member list.

Cheers!
Mike

Reply to This

Hello Everyone,

I have a different requirement. Is there a REST way to get list of all networks a user is part of?

Thanks,
Raj

Reply to This

Can we do this within Ning? I've been wanting to get my members list but I only get the ID in this format:

2107362:User:42
2107362:User:1

In my understanding, the "2107362" is the application ID for my network and the "User:{number}" is the member ID with regards to my network. I got that result using XN_Query.

Reply to This

Thought it took me awhile, I already got it. I just played with the objects and used XN_Query::debugHtml(). =)

Reply to This

RSS

We're Hiring

We are looking for talented and passionate individuals to join our growing team.

Visit our engineering jobs and see if Ning is right for you.

© 2008   Created by Ning Developer Admin

Badges  |  Report an Issue  |  Privacy  |  Terms of Service