]> git.mxchange.org Git - friendica.git/blobdiff - doc/api.md
Merge remote-tracking branch 'upstream/master'
[friendica.git] / doc / api.md
index f050ae4304f98d7682003100eee6781ce2c63aff..b759b4697c0dbd51721745f2102939bbca8deed0 100644 (file)
@@ -1,6 +1,9 @@
 Friendica API\r
 ===\r
-The Friendica API aims to be compatible to the [GNU Social API](http://skilledtests.com/wiki/Twitter-compatible_API) and the [Twitter API](https://dev.twitter.com/rest/public).\r
+\r
+* [Home](help)\r
+\r
+The Friendica API aims to be compatible to the [GNU Social API](http://wiki.gnusocial.de/gnusocial:api) and the [Twitter API](https://dev.twitter.com/rest/public).\r
 \r
 Please refer to the linked documentation for further information.\r
 \r
@@ -52,20 +55,20 @@ Error body is
 \r
 json:\r
 ```\r
-{\r
-"error": "Specific error message",\r
-"request": "API path requested",\r
-"code": "HTTP error code"\r
-}\r
+       {\r
+               "error": "Specific error message",\r
+               "request": "API path requested",\r
+               "code": "HTTP error code"\r
+       }\r
 ```\r
 \r
 xml:\r
 ```\r
-<status>\r
-<error>Specific error message</error>\r
-<request>API path requested</request>\r
-<code>HTTP error code</code>\r
-</status>\r
+       <status>\r
+               <error>Specific error message</error>\r
+               <request>API path requested</request>\r
+               <code>HTTP error code</code>\r
+       </status>\r
 ```\r
 \r
 ---\r
@@ -104,6 +107,7 @@ Unofficial Twitter command. It shows all direct answers (excluding the original
 * max_id: maximum id\r
 * getText: Defines the format of the status field. Can be "html" or "plain"\r
 * include_entities: "true" shows entities for pictures and links (Default: false)\r
+* friendica_verbose: "true" enables different error returns (default: "false")\r
 \r
 #### Unsupported parameters\r
 * skip_status\r
@@ -116,6 +120,7 @@ Unofficial Twitter command. It shows all direct answers (excluding the original
 * since_id: minimal id\r
 * max_id: maximum id\r
 * getText: Defines the format of the status field. Can be "html" or "plain"\r
+* friendica_verbose: "true" enables different error returns (default: "false")\r
 \r
 ---\r
 ### direct_messages/conversation (*; AUTH)\r
@@ -127,6 +132,18 @@ Shows all direct messages of a conversation
 * max_id: maximum id\r
 * getText: Defines the format of the status field. Can be "html" or "plain"\r
 * uri: URI of the conversation\r
+* friendica_verbose: "true" enables different error returns (default: "false")\r
+\r
+---\r
+### direct_messages/sent (*; AUTH)\r
+#### Parameters\r
+* count: Items per page (default: 20)\r
+* page: page number\r
+* since_id: minimal id\r
+* max_id: maximum id\r
+* getText: Defines the format of the status field. Can be "html" or "plain"\r
+* include_entities: "true" shows entities for pictures and links (Default: false)\r
+* friendica_verbose: "true" enables different error returns (default: "false")\r
 \r
 ---\r
 ### direct_messages/new (POST,PUT; AUTH)\r
@@ -138,14 +155,22 @@ Shows all direct messages of a conversation
 * title: Title of the direct message\r
 \r
 ---\r
-### direct_messages/sent (*; AUTH)\r
+### direct_messages/destroy (POST,DELETE; AUTH)\r
 #### Parameters\r
-* count: Items per page (default: 20)\r
-* page: page number\r
-* since_id: minimal id\r
-* max_id: maximum id\r
-* getText: Defines the format of the status field. Can be "html" or "plain"\r
-* include_entities: "true" shows entities for pictures and links (Default: false)\r
+* id: id of the message to be deleted\r
+* include_entities: optional, currently not yet implemented\r
+* friendica_parenturi: optional, can be used for increased safety to delete only intended messages\r
+* friendica_verbose: "true" enables different error returns (default: "false")\r
+\r
+#### Return values\r
+\r
+On success:\r
+* JSON return as defined for Twitter API not yet implemented\r
+* on friendica_verbose=true: JSON return {"result":"ok","message":"message deleted"}\r
+\r
+On error:\r
+HTTP 400 BadRequest\r
+* on friendica_verbose=true: different JSON returns {"result":"error","message":"xyz"}\r
 \r
 ---\r
 ### favorites (*; AUTH)\r
@@ -388,6 +413,18 @@ Friendica doesn't allow showing friends of other users.
 ---\r
 ### statusnet/config (*)\r
 \r
+---\r
+### statusnet/conversation (*; AUTH)\r
+It shows all direct answers (excluding the original post) to a given id.\r
+\r
+#### Parameter\r
+* id: id of the post\r
+* count: Items per page (default: 20)\r
+* page: page number\r
+* since_id: minimal id\r
+* max_id: maximum id\r
+* include_entities: "true" shows entities for pictures and links (Default: false)\r
+\r
 ---\r
 ### statusnet/version (*)\r
 \r
@@ -605,47 +642,47 @@ An image used as profile image has only scale 4-6, other images only 0-3
 \r
 json\r
 ```\r
-{\r
-"id": "photo id"\r
-"created": "date(YYYY-MM-GG HH:MM:SS)",\r
-"edited": "date(YYYY-MM-GG HH:MM:SS)",\r
-"title": "photo title",\r
-"desc": "photo description",\r
-"album": "album name",\r
-"filename": "original file name",\r
-"type": "mime type",\r
-"height": "number",\r
-"width": "number",\r
-"profile": "1 if is profile photo",\r
-"link": {\r
-"<scale>": "url to image"\r
-...\r
-},\r
-// if 'scale' is set\r
-"datasize": "size in byte",\r
-"data": "base64 encoded image data"\r
-}\r
+       {\r
+               "id": "photo id"\r
+               "created": "date(YYYY-MM-GG HH:MM:SS)",\r
+               "edited": "date(YYYY-MM-GG HH:MM:SS)",\r
+               "title": "photo title",\r
+               "desc": "photo description",\r
+               "album": "album name",\r
+               "filename": "original file name",\r
+               "type": "mime type",\r
+               "height": "number",\r
+               "width": "number",\r
+               "profile": "1 if is profile photo",\r
+               "link": {\r
+                       "<scale>": "url to image"\r
+                       ...\r
+               },\r
+               // if 'scale' is set\r
+               "datasize": "size in byte",\r
+               "data": "base64 encoded image data"\r
+       }\r
 ```\r
 \r
 xml\r
 ```\r
-<photo>\r
-<id>photo id</id>\r
-<created>date(YYYY-MM-GG HH:MM:SS)</created>\r
-<edited>date(YYYY-MM-GG HH:MM:SS)</edited>\r
-<title>photo title</title>\r
-<desc>photo description</desc>\r
-<album>album name</album>\r
-<filename>original file name</filename>\r
-<type>mime type</type>\r
-<height>number</height>\r
-<width>number</width>\r
-<profile>1 if is profile photo</profile>\r
-<links type="array">\r
-<link type="mime type" scale="scale number" href="image url"/>\r
-...\r
-</links>\r
-</photo>\r
+       <photo>\r
+               <id>photo id</id>\r
+               <created>date(YYYY-MM-GG HH:MM:SS)</created>\r
+               <edited>date(YYYY-MM-GG HH:MM:SS)</edited>\r
+               <title>photo title</title>\r
+               <desc>photo description</desc>\r
+               <album>album name</album>\r
+               <filename>original file name</filename>\r
+               <type>mime type</type>\r
+               <height>number</height>\r
+               <width>number</width>\r
+               <profile>1 if is profile photo</profile>\r
+               <links type="array">\r
+               <link type="mime type" scale="scale number" href="image url"/>\r
+                       ...\r
+               </links>\r
+       </photo>\r
 ```\r
 \r
 ---\r
@@ -657,31 +694,90 @@ Returns a list of all photo resources of the logged in user.
 \r
 json\r
 ```\r
-[\r
-{\r
-id: "resource_id",\r
-album: "album name",\r
-filename: "original file name",\r
-type: "image mime type",\r
-thumb: "url to thumb sized image"\r
-},\r
-...\r
-]\r
+       [\r
+               {\r
+                       id: "resource_id",\r
+                       album: "album name",\r
+                       filename: "original file name",\r
+                       type: "image mime type",\r
+                       thumb: "url to thumb sized image"\r
+               },\r
+               ...\r
+       ]\r
 ```\r
 \r
 xml\r
 ```\r
-<photos type="array">\r
-<photo id="resource_id"\r
-album="album name"\r
-filename="original file name"\r
-type="image mime type">\r
-"url to thumb sized image"\r
-</photo>\r
-...\r
-</photos>\r
+       <photos type="array">\r
+               <photo id="resource_id"\r
+               album="album name"\r
+               filename="original file name"\r
+               type="image mime type">\r
+                       "url to thumb sized image"\r
+               </photo>\r
+               ...\r
+       </photos>\r
 ```\r
 \r
+---\r
+### friendica/direct_messages_setseen (GET; AUTH)\r
+#### Parameters\r
+* id: id of the message to be updated as seen\r
+\r
+#### Return values\r
+\r
+On success:\r
+* JSON return {"result":"ok","message":"message set to seen"}\r
+\r
+On error:\r
+* different JSON returns {"result":"error","message":"xyz"}\r
+\r
+---\r
+### friendica/direct_messages_search (GET; AUTH)\r
+#### Parameters\r
+* searchstring: string for which the API call should search as '%searchstring%' in field 'body' of all messages of the authenticated user (caption ignored)\r
+\r
+#### Return values\r
+Returns only tested with JSON, XML might work as well.\r
+\r
+On success:\r
+* JSON return {"success":"true","search_results": array of found messages}\r
+* JSOn return {"success":"false","search_results":"nothing found"}\r
+\r
+On error:\r
+* different JSON returns {"result":"error","message":"searchstring not specified"}\r
+\r
+---\r
+### friendica/profile/show (GET; AUTH)\r
+show data of all profiles or a single profile of the authenticated user\r
+\r
+#### Parameters\r
+* profile_id: id of the profile to be returned (optional, if omitted all profiles are returned by default)\r
+\r
+#### Return values\r
+On success: Array of:\r
+\r
+* multi_profiles: true if user has activated multi_profiles\r
+* global_dir: URL of the global directory set in server settings\r
+* friendica_owner: user data of the authenticated user\r
+* profiles: array of the profile data\r
+\r
+On error: \r
+HTTP 403 Forbidden: when no authentication provided\r
+HTTP 400 Bad Request: if given profile_id is not in db or not assigned to authenticated user\r
+\r
+General description of profile data in API returns:\r
+* profile_id\r
+* profile_name\r
+* is_default: true if this is the public profile\r
+* hide_friends: true if friends are hidden\r
+* profile_photo\r
+* profile_thumb\r
+* publish: true if published on the server's local directory\r
+* net_publish: true if published to global_dir\r
+* description ... homepage: different data fields from 'profile' table in database\r
+* users: array with the users allowed to view this profile (empty if is_default=true)\r
+\r
 \r
 ---\r
 ## Not Implemented API calls\r
@@ -706,7 +802,6 @@ The following API calls from the Twitter API aren't implemented neither in Frien
 * statuses/lookup\r
 * direct_messages/show\r
 * search/tweets\r
-* direct_messages/destroy\r
 * friendships/no_retweets/ids\r
 * friendships/incoming\r
 * friendships/outgoing\r