From 93ba393559f0f38b6c45bb1ba4a4e4d9c47f6679 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Thu, 23 Aug 2018 16:09:50 +0200 Subject: [PATCH] API: add private value (bool) to item results (#5647) * API: add private value (bool) to item results friendica:private for xml friendica_privarte for json * API Docs: add a section about custom value returned in status data --- doc/api.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ include/api.php | 1 + 2 files changed, 68 insertions(+) diff --git a/doc/api.md b/doc/api.md index 08fca74fa4..07813b6a77 100644 --- a/doc/api.md +++ b/doc/api.md @@ -634,6 +634,73 @@ Friendica doesn't allow showing the friends of other users. * trim_user * contributor_details +--- + +### Return values for statuses/* api calls + +Returned status object is conform to GNU Social/Twitter api. + +Friendica adds some addictional fields: + +- owner: a user object, it's the owner of the item. +- private: boolean, true if the item is marked as private +- activities: map with activities related to the item. Every activity is a list of user objects. + +This properties are prefixed with "friendica_" in JSON responses and namespaced under "http://friendi.ca/schema/api/1/" in XML responses + +JSON: + +```json +[ + { + // ... + 'friendica_owner' : { + // user object + }, + 'friendica_private' : true, + 'friendica_activities': { + 'like': [ + { + // user object + }, + // ... + ], + 'dislike': [], + 'attendyes': [], + 'attendno': [], + 'attendmaybe': [] + } + }, + // ... +] +``` + +XML: + +```xml + + + + + true + + + + + + + + + + + + + + + +``` + + --- ### statusnet/config (*) diff --git a/include/api.php b/include/api.php index 7450d650eb..f40674b894 100644 --- a/include/api.php +++ b/include/api.php @@ -2888,6 +2888,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") 'favorited' => $item['starred'] ? true : false, 'user' => $status_user , 'friendica_owner' => $owner_user, + 'friendica_private' => $item['private'] == 1, //'entities' => NULL, 'statusnet_html' => $converted["html"], 'statusnet_conversation_id' => $item['parent'],