Hi there, Finally I managed to understand a little bit more the new API and now I can login in, check the password and write a new post to thewire using my iphone client application.
But now I am stack with getting information instead of posting or checking parameters.
I would like to check thewire posts for one user. Right now I can get that info, but I obtain a whole html code that lists all the posts, each of them has different fields, for example:
guid: 25
type: object
subtype: 5
owner_guid: 2
container_guid: 2
site_guid: 1
time_created: 1268392788
time_updated: 1268392788
title:
description: PRUEBA1HOLA
------------
But I just want to obtain the owner and the description of the posts (Now I obtain as the example above but with all the posts).
My function is really simple:
function see_thewire($username){
$user = get_user_by_username($username);
$arr = array('types' => 'object', 'subtypes' => 'thewire', 'owner_guid' => $user, 'limit' => 10);*/
$result=elgg_list_entities($arr);
return $result;
}
What function instead of the elgg_list_entities should I use for this purpose?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Brett@brett.profitt
Brett - 0 likes
- HitMaker@HitMaker
HitMaker - 0 likes
- HitMaker@HitMaker
HitMaker - 0 likes
You must log in to post replies.elgg_list_entities() is meant to return pre-formatted HTML as defined by the entity views. elgg_get_entities() will return just the entities so you're able to format them how you want. That one should work to just return entities, but you'll need to pass them to a view to format it how you want.
I don't know what format your client app expects, but it might be worthwhile implementing a new view for it.
Thanks man!!!, the format is still opened to discussion because I want first to finnish with the API and then, focus myself to develop the requests of the client part! :)
It won't be difficult to adapt what I already have :)
I have another question about general stuff
I am trying to make a simple XML HTTPRequest, using either Dashcode (currently developing an application) or using a htm file in my local server.
But I always obtain the same. DOM Exception, I don't know why.
I call the httprequest with:
http://localhost/elgi1.7/html/services/api/rest/xml/?method=login&username=admin&password=h1tm@ke8&api_key=d7804b697fca84c17a30661667ed4bb75e3bd6e7
And in my browser I obtain directly:
But if I create a htm file with:
<script type="text/javascript">
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://localhost/elgi1.7/html/services/api/rest/xml/?method=login&username=admin&password=h1tm@ke8&api_key=d7804b697fca84c17a30661667ed4bb75e3bd6e7",false);
xmlhttp.send(null);
xmlDoc=xmlhttp.responseXML;
</script>
It gives me the same DOM Exception that I get with the Dashcode code (similar coding), both javascripts.
And I don't know why :(