From afc7d316a72fe3d50d1fdd6cf099a3f375c493a9 Mon Sep 17 00:00:00 2001 From: gerhard6380 Date: Fri, 23 Sep 2016 19:26:44 +0200 Subject: [PATCH] Change API documentation to contain new API call /api/friendica/profile/show --- doc/api.md | 32 ++++++++++++++++++++++++++++++++ include/api.php | 16 +--------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/doc/api.md b/doc/api.md index 0570e8e990..bf1507adba 100644 --- a/doc/api.md +++ b/doc/api.md @@ -744,6 +744,38 @@ On success: On error: * different JSON returns {"result":"error","message":"searchstring not specified"} +--- +### friendica/profile/show (GET; AUTH) +show data of all profiles or a single profile of the authenticated user + +#### Parameters +* profile_id: id of the profile to be returned (optional, if omitted all profiles are returned by default) + +#### Return values +On success: Array of: + +* multi_profiles: true if user has activated multi_profiles +* global_dir: URL of the global directory set in server settings +* friendica_owner: user data of the authenticated user +* profiles: array of the profile data + +On error: +HTTP 403 Forbidden: when no authentication provided +HTTP 400 Bad Request: if given profile_id is not in db or not assigned to authenticated user + +General description of profile data in API returns: +* profile_id +* profile_name +* is_default: true if this is the public profile +* hide_friends: true if friends are hidden +* profile_photo +* profile_thumb +* publish: true if published on the server's local directory +* net_publish: true if published to global_dir +* description ... homepage: different data fields from 'profile' table in database +* users: array with the users allowed to view this profile (empty if is_default=true) + + --- ## Not Implemented API calls The following API calls are implemented in GNU Social but not in Friendica: (incomplete) diff --git a/include/api.php b/include/api.php index de7195dbb6..736f683db3 100644 --- a/include/api.php +++ b/include/api.php @@ -2462,20 +2462,6 @@ 'users' => null); return $profile; } - if ($type == "xml") { - $xml_activities = array(); - foreach ($activities as $k => $v) { - // change xml element from "like" to "friendica:like" - $xml_activities["friendica:".$k] = $v; - // add user data into xml output - $k_user = 0; - foreach ($v as $user) - $xml_activities["friendica:".$k][$k_user++.":user"] = $user; - } - $activities = $xml_activities; - } - - return $activities; } /** @@ -4004,7 +3990,7 @@ } // return settings, authenticated user and profiles data - $result = array('multi_profiles' => $multi_profiles, + $result = array('multi_profiles' => $multi_profiles ? true : false, 'global_dir' => $directory, 'friendica_owner' => api_get_user($a, intval(api_user())), 'profiles' => $profiles);