]> git.mxchange.org Git - friendica.git/blob - doc/api.md
Merge pull request #4119 from Rudloff/patch-1
[friendica.git] / doc / api.md
1 # Friendica API
2
3 <!-- markdownlint-disable MD010 MD013 MD024 -->
4
5 * [Home](help)
6
7 The Friendica API aims to be compatible with the [GNU Social API](http://wiki.gnusocial.de/gnusocial:api) and the [Twitter API](https://dev.twitter.com/rest/public).
8
9 Please refer to the linked documentation for further information.
10
11 ## Implemented API calls
12
13 ### General
14
15 #### HTTP Method
16
17 API endpoints can restrict the method used to request them.
18 Using an invalid method results in HTTP error 405 "Method Not Allowed".
19
20 In this document, the required method is listed after the endpoint name. "*" means every method can be used.
21
22 #### Auth
23
24 Friendica supports basic http auth and OAuth 1 to authenticate the user to the api.
25
26 OAuth settings can be added by the user in web UI under /settings/oauth/
27
28 In this document, endpoints which requires auth are marked with "AUTH" after endpoint name
29
30 #### Unsupported parameters
31
32 * cursor: Not implemented in GNU Social
33 * trim_user: Not implemented in GNU Social
34 * contributor_details: Not implemented in GNU Social
35 * place_id: Not implemented in GNU Social
36 * display_coordinates: Not implemented in GNU Social
37 * include_rts: To-Do
38 * include_my_retweet: Retweets in Friendica are implemented in a different way
39
40 #### Different behaviour
41
42 * screen_name: The nick name in friendica is only unique in each network but not for all networks. The users are searched in the following priority: Friendica, StatusNet/GNU Social, Diaspora, pump.io, Twitter. If no contact was found by this way, then the first contact is taken.
43 * include_entities: Default is "false". If set to "true" then the plain text is formatted so that links are having descriptions.
44
45 #### Return values
46
47 * cid: Contact id of the user (important for "contact_allow" and "contact_deny")
48 * network: network of the user
49
50 #### Errors
51
52 When an error occurs in API call, an HTTP error code is returned, with an error message
53 Usually:
54
55 * 400 Bad Request: if parameters are missing or items can't be found
56 * 403 Forbidden: if the authenticated user is missing
57 * 405 Method Not Allowed: if API was called with an invalid method, eg. GET when API require POST
58 * 501 Not Implemented: if the requested API doesn't exist
59 * 500 Internal Server Error: on other error conditions
60
61 Error body is
62
63 json:
64
65 ```json
66         {
67                 "error": "Specific error message",
68                 "request": "API path requested",
69                 "code": "HTTP error code"
70         }
71 ```
72
73 xml:
74
75 ```xml
76         <status>
77                 <error>Specific error message</error>
78                 <request>API path requested</request>
79                 <code>HTTP error code</code>
80         </status>
81 ```
82
83 ---
84
85 ### account/rate_limit_status (*; AUTH)
86
87 ---
88
89 ### account/verify_credentials (*; AUTH)
90
91 #### Parameters
92
93 * skip_status: Don't show the "status" field. (Default: false)
94 * include_entities: "true" shows entities for pictures and links (Default: false)
95
96 ---
97
98 ### conversation/show (*; AUTH)
99
100 Unofficial Twitter command. It shows all direct answers (excluding the original post) to a given id.
101
102 #### Parameter
103
104 * id: id of the post
105 * count: Items per page (default: 20)
106 * page: page number
107 * since_id: minimum id
108 * max_id: maximum id
109 * include_entities: "true" shows entities for pictures and links (Default: false)
110
111 #### Unsupported parameters
112
113 * include_rts
114 * trim_user
115 * contributor_details
116
117 ---
118
119 ### direct_messages (*; AUTH)
120
121 #### Parameters
122
123 * count: Items per page (default: 20)
124 * page: page number
125 * since_id: minimum id
126 * max_id: maximum id
127 * getText: Defines the format of the status field. Can be "html" or "plain"
128 * include_entities: "true" shows entities for pictures and links (Default: false)
129 * friendica_verbose: "true" enables different error returns (default: "false")
130
131 #### Unsupported parameters
132
133 * skip_status
134
135 ---
136
137 ### direct_messages/all (*; AUTH)
138
139 #### Parameters
140
141 * count: Items per page (default: 20)
142 * page: page number
143 * since_id: minimum id
144 * max_id: maximum id
145 * getText: Defines the format of the status field. Can be "html" or "plain"
146 * friendica_verbose: "true" enables different error returns (default: "false")
147
148 ---
149
150 ### direct_messages/conversation (*; AUTH)
151
152 Shows all direct messages of a conversation
153
154 #### Parameters
155
156 * count: Items per page (default: 20)
157 * page: page number
158 * since_id: minimum id
159 * max_id: maximum id
160 * getText: Defines the format of the status field. Can be "html" or "plain"
161 * uri: URI of the conversation
162 * friendica_verbose: "true" enables different error returns (default: "false")
163
164 ---
165
166 ### direct_messages/sent (*; AUTH)
167
168 #### Parameters
169
170 * count: Items per page (default: 20)
171 * page: page number
172 * since_id: minimum id
173 * max_id: maximum id
174 * getText: Defines the format of the status field. Can be "html" or "plain"
175 * include_entities: "true" shows entities for pictures and links (Default: false)
176 * friendica_verbose: "true" enables different error returns (default: "false")
177
178 ---
179
180 ### direct_messages/new (POST,PUT; AUTH)
181
182 #### Parameters
183
184 * user_id: id of the user
185 * screen_name: screen name (for technical reasons, this value is not unique!)
186 * text: The message
187 * replyto: ID of the replied direct message
188 * title: Title of the direct message
189
190 ---
191
192 ### direct_messages/destroy (POST,DELETE; AUTH)
193
194 #### Parameters
195
196 * id: id of the message to be deleted
197 * include_entities: optional, currently not yet implemented
198 * friendica_parenturi: optional, can be used for increased safety to delete only intended messages
199 * friendica_verbose: "true" enables different error returns (default: "false")
200
201 #### Return values
202
203 On success:
204
205 * JSON return as defined for Twitter API not yet implemented
206 * on friendica_verbose=true: JSON return {"result":"ok","message":"message deleted"}
207
208 On error:
209 HTTP 400 BadRequest
210
211 * on friendica_verbose=true: different JSON returns {"result":"error","message":"xyz"}
212
213 ---
214
215 ### externalprofile/show (*)
216
217 #### Parameters
218
219 * profileurl: profile url
220
221 ---
222
223 ### favorites (*; AUTH)
224
225 #### Parameters
226
227 * count: Items per page (default: 20)
228 * page: page number
229 * since_id: minimum id
230 * max_id: maximum id
231 * include_entities: "true" shows entities for pictures and links (Default: false)
232
233 #### Unsupported parameters
234
235 * user_id
236 * screen_name
237
238 Favorites aren't displayed to other users, so "user_id" and "screen_name" are unsupported.
239 Set this values will result in an empty array.
240
241 ---
242
243 ### favorites/create (POST,PUT; AUTH)
244
245 #### Parameters
246
247 * id
248 * include_entities: "true" shows entities for pictures and links (Default: false)
249
250 ---
251
252 ### favorites/destroy (POST,DELETE; AUTH)
253
254 #### Parameters
255
256 * id
257 * include_entities: "true" shows entities for pictures and links (Default: false)
258
259 ---
260
261 ### followers/ids (*; AUTH)
262
263 #### Parameters
264
265 * stringify_ids: Send id numbers as text (true) or integers (false)? (default: false)
266
267 #### Unsupported parameters
268
269 * user_id
270 * screen_name
271 * cursor
272
273 Friendica doesn't allow showing the followers of other users.
274
275 ---
276
277 ### friends/ids (*; AUTH)
278
279 #### Parameters
280
281 * stringify_ids: Send the id numbers as text (true) or integers (false)? (default: false)
282
283 #### Unsupported parameters
284
285 * user_id
286 * screen_name
287 * cursor
288
289 Friendica doesn't allow showing the friends of other users.
290
291 ---
292
293 ### help/test (*)
294
295 ---
296
297 ### media/upload (POST,PUT; AUTH)
298
299 #### Parameters
300
301 * media: image data
302
303 ---
304
305 ### oauth/request_token (*)
306
307 #### Parameters
308
309 * oauth_callback
310
311 #### Unsupported parameters
312
313 * x_auth_access_type
314
315 ---
316
317 ### oauth/access_token (*)
318
319 #### Parameters
320
321 * oauth_verifier
322
323 #### Unsupported parameters
324
325 * x_auth_password
326 * x_auth_username
327 * x_auth_mode
328
329 ---
330
331 ### statuses/destroy (POST,DELETE; AUTH)
332
333 #### Parameters
334
335 * id: message number
336 * include_entities: "true" shows entities for pictures and links (Default: false)
337
338 #### Unsupported parameters
339
340 * trim_user
341
342 ---
343
344 ### statuses/followers (*; AUTH)
345
346 #### Parameters
347
348 * include_entities: "true" shows entities for pictures and links (Default: false)
349
350 ---
351
352 ### statuses/friends (*; AUTH)
353
354 #### Parameters
355
356 * include_entities: "true" shows entities for pictures and links (Default: false)
357
358 ---
359
360 ### blocks/list (*; AUTH)
361
362 #### Parameters
363
364 * include_entities: "true" shows entities for pictures and links (Default: false)
365 * count: Items per page (default: 20).
366 * page: page number
367
368 #### Unsupported parameters
369
370 * cursor
371 * skip_status
372
373 ---
374
375 ### statuses/friends_timeline (*; AUTH)
376
377 #### Parameters
378
379 * count: Items per page (default: 20)
380 * page: page number
381 * since_id: minimum id
382 * max_id: maximum id
383 * exclude_replies: don't show replies (default: false)
384 * conversation_id: Shows all statuses of a given conversation.
385 * include_entities: "true" shows entities for pictures and links (Default: false)
386
387 #### Unsupported parameters
388
389 * include_rts
390 * trim_user
391 * contributor_details
392
393 ---
394
395 ### statuses/home_timeline (*; AUTH)
396
397 #### Parameters
398
399 * count: Items per page (default: 20)
400 * page: page number
401 * since_id: minimum id
402 * max_id: maximum id
403 * exclude_replies: don't show replies (default: false)
404 * conversation_id: Shows all statuses of a given conversation.
405 * include_entities: "true" shows entities for pictures and links (Default: false)
406
407 #### Unsupported parameters
408
409 * include_rts
410 * trim_user
411 * contributor_details
412
413 ---
414
415 ### statuses/mentions (*; AUTH)
416
417 #### Parameters
418
419 * count: Items per page (default: 20)
420 * page: page number
421 * since_id: minimum id
422 * max_id: maximum id
423 * include_entities: "true" shows entities for pictures and links (Default: false)
424
425 #### Unsupported parameters
426
427 * include_rts
428 * trim_user
429 * contributor_details
430
431 ---
432
433 ### statuses/public_timeline (*; AUTH)
434
435 #### Parameters
436
437 * count: Items per page (default: 20)
438 * page: page number
439 * since_id: minimum id
440 * max_id: maximum id
441 * exclude_replies: don't show replies (default: false)
442 * conversation_id: Shows all statuses of a given conversation.
443 * include_entities: "true" shows entities for pictures and links (Default: false)
444
445 #### Unsupported parameters
446
447 * trim_user
448
449 ---
450
451 ### statuses/networkpublic_timeline (*; AUTH)
452
453 #### Parameters
454
455 * count: Items per page (default: 20)
456 * page: page number
457 * since_id: minimum id
458 * max_id: maximum id
459 * include_entities: "true" shows entities for pictures and links (Default: false)
460
461 ---
462
463 ### statuses/replies (*; AUTH)
464
465 #### Parameters
466
467 * count: Items per page (default: 20)
468 * page: page number
469 * since_id: minimum id
470 * max_id: maximum id
471 * include_entities: "true" shows entities for pictures and links (Default: false)
472
473 #### Unsupported parameters
474
475 * include_rts
476 * trim_user
477 * contributor_details
478
479 ---
480
481 ### statuses/retweet (POST,PUT; AUTH)
482
483 #### Parameters
484
485 * id: message number
486 * include_entities: "true" shows entities for pictures and links (Default: false)
487
488 #### Unsupported parameters
489
490 * trim_user
491
492 ---
493
494 ### statuses/show (*; AUTH)
495
496 #### Parameters
497
498 * id: message number
499 * conversation: if set to "1" show all messages of the conversation with the given id
500 * include_entities: "true" shows entities for pictures and links (Default: false)
501
502 #### Unsupported parameters
503
504 * include_my_retweet
505 * trim_user
506
507 ---
508
509 ### statuses/update, statuses/update_with_media
510
511 #### Parameters
512
513 * title: Title of the status
514 * status: Status in text format
515 * htmlstatus: Status in HTML format
516 * in_reply_to_status_id
517 * lat: latitude
518 * long: longitude
519 * media: image data
520 * source: Application name
521 * group_allow
522 * contact_allow
523 * group_deny
524 * contact_deny
525 * network
526 * include_entities: "true" shows entities for pictures and links (Default: false)
527 * media_ids: (By now only a single value, no array)
528
529 #### Unsupported parameters
530
531 * trim_user
532 * place_id
533 * display_coordinates
534
535 ---
536
537 ### statuses/user_timeline (*; AUTH)
538
539 #### Parameters
540
541 * user_id: id of the user
542 * screen_name: screen name (for technical reasons, this value is not unique!)
543 * count: Items per page (default: 20)
544 * page: page number
545 * since_id: minimum id
546 * max_id: maximum id
547 * exclude_replies: don't show replies (default: false)
548 * conversation_id: Shows all statuses of a given conversation.
549 * include_entities: "true" shows entities for pictures and links (Default: false)
550
551 #### Unsupported parameters
552
553 * include_rts
554 * trim_user
555 * contributor_details
556
557 ---
558
559 ### statusnet/config (*)
560
561 ---
562
563 ### statusnet/conversation (*; AUTH)
564
565 It shows all direct answers (excluding the original post) to a given id.
566
567 #### Parameter
568
569 * id: id of the post
570 * count: Items per page (default: 20)
571 * page: page number
572 * since_id: minimum id
573 * max_id: maximum id
574 * include_entities: "true" shows entities for pictures and links (Default: false)
575
576 ---
577
578 ### statusnet/version (*)
579
580 #### Unsupported parameters
581
582 * user_id
583 * screen_name
584 * cursor
585
586 Friendica doesn't allow showing followers of other users.
587
588 ---
589
590 ### search (*; AUTH)
591
592 #### Parameters
593
594 * q: search query
595 * page: the page number (starting at 1) to return
596 * rpp: the number of statuses to return per page
597 * count: alias for the rpp parameter
598 * since_id: returns statuses with ids greater than the given id
599 * max_id: returns statuses with ids lower or equal to the given id
600
601 #### Unsupported parameters
602
603 * geocode
604 * lang
605 * locale
606 * result_type
607 * until
608 * include_entities
609
610 ---
611
612 ### search/tweets (*; AUTH)
613
614 This is an alias for `search`.
615
616 ---
617
618 ### saved_searches/list (*; AUTH)
619
620 This call does not have any parameter.
621
622 ---
623
624 ### users/search (*)
625
626 #### Parameters
627
628 * q: name of the user
629
630 #### Unsupported parameters
631
632 * page
633 * count
634 * include_entities
635
636 ---
637
638 ### users/show (*)
639
640 #### Parameters
641
642 * user_id: id of the user
643 * screen_name: screen name (for technical reasons, this value is not unique!)
644 * include_entities: "true" shows entities for pictures and links (Default: false)
645
646 #### Unsupported parameters
647
648 * user_id
649 * screen_name
650 * cursor
651
652 Friendica doesn't allow showing friends of other users.
653
654 ---
655
656 ### users/lookup (*; AUTH)
657
658 #### Parameters
659
660 * user_id: list of ids to lookup
661
662 #### Unsupported parameters
663
664 * screen_name
665 * include_entities
666
667 ---
668
669 ### account/update_profile_image (POST; AUTH)
670
671 #### Parameters
672
673 * image: image data as base64 (Twitter has a limit of 700kb, Friendica allows more)
674 * profile_id (optional): id of the profile for which the image should be used, default is changing the default profile
675
676 uploads a new profile image (scales 4-6) to database, changes default or specified profile to the new photo
677
678 #### Return values
679
680 On success:
681
682 * JSON return: returns the updated user details (see account/verify_credentials)
683
684 On error:
685
686 * 403 FORBIDDEN: if not authenticated
687 * 400 BADREQUEST: "no media data submitted", "profile_id not available"
688 * 500 INTERNALSERVERERROR: "image size exceeds PHP config settings, file was rejected by server",
689                         "image size exceeds Friendica Config setting (uploaded size: x)",
690                         "unable to process image data",
691                         "image upload failed"
692
693 ---
694
695 ### friendships/incoming (*; AUTH)
696
697 #### Unsupported parameters
698
699 * cursor
700 * stringify_ids
701
702 ## Implemented API calls (not compatible with other APIs)
703
704 ---
705
706 ### friendica/activity/[verb]
707
708 #### parameters
709
710 * id: item id
711
712 Add or remove an activity from an item.
713 'verb' can be one of:
714
715 * like
716 * dislike
717 * attendyes
718 * attendno
719 * attendmaybe
720
721 To remove an activity, prepend the verb with "un", eg. "unlike" or "undislike"
722 Attend verbs disable eachother: that means that if "attendyes" was added to an item, adding "attendno" remove previous "attendyes".
723 Attend verbs should be used only with event-related items (there is no check at the moment)
724
725 #### Return values
726
727 On success:
728 json:
729
730 ```"ok"```
731
732 xml:
733
734 ```<ok>true</ok>```
735
736 On error:
737 HTTP 400 BadRequest
738
739 ---
740
741 ### friendica/group_show (*; AUTH)
742
743 Return all or a specified group of the user with the containing contacts as array.
744
745 #### Parameters
746
747 * gid: optional, if not given, API returns all groups of the user
748
749 #### Return values
750
751 Array of:
752
753 * name: name of the group
754 * gid: id of the group
755 * user: array of group members (return from api_get_user() function for each member)
756
757 ---
758
759 ### friendica/group_delete (POST,DELETE; AUTH)
760
761 delete the specified group of contacts; API call need to include the correct gid AND name of the group to be deleted.
762
763 #### Parameters
764
765 * gid: id of the group to be deleted
766 * name: name of the group to be deleted
767
768 #### Return values
769
770 Array of:
771
772 * success: true if successfully deleted
773 * gid: gid of the deleted group
774 * name: name of the deleted group
775 * status: â€ždeleted“ if successfully deleted
776 * wrong users: empty array
777
778 ---
779
780 ### friendica/group_create (POST,PUT; AUTH)
781
782 Create the group with the posted array of contacts as members.
783
784 #### Parameters
785
786 * name: name of the group to be created
787
788 #### POST data
789
790 JSON data as Array like the result of "users/group_show":
791
792 * gid
793 * name
794 * array of users
795
796 #### Return values
797
798 Array of:
799
800 * success: true if successfully created or reactivated
801 * gid: gid of the created group
802 * name: name of the created group
803 * status: â€žmissing user“ | â€žreactivated“ | â€žok“
804 * wrong users: array of users, which were not available in the contact table
805
806 ---
807
808 ### friendica/group_update (POST)
809
810 Update the group with the posted array of contacts as members (post all members of the group to the call; function will remove members not posted).
811
812 #### Parameters
813
814 * gid: id of the group to be changed
815 * name: name of the group to be changed
816
817 #### POST data
818
819 JSON data as array like the result of â€žusers/group_show“:
820
821 * gid
822 * name
823 * array of users
824
825 #### Return values
826
827 Array of:
828
829 * success: true if successfully updated
830 * gid: gid of the changed group
831 * name: name of the changed group
832 * status: â€žmissing user“ | â€žok“
833 * wrong users: array of users, which were not available in the contact table
834
835 ---
836
837 ### friendica/notifications (GET)
838
839 Return last 50 notification for current user, ordered by date with unseen item on top
840
841 #### Parameters
842
843 none
844
845 #### Return values
846
847 Array of:
848
849 * id: id of the note
850 * type: type of notification as int (see NOTIFY_* constants in boot.php)
851 * name: full name of the contact subject of the note
852 * url: contact's profile url
853 * photo: contact's profile photo
854 * date: datetime string of the note
855 * timestamp: timestamp of the node
856 * date_rel: relative date of the note (eg. "1 hour ago")
857 * msg: note message in bbcode
858 * msg_html: note message in html
859 * msg_plain: note message in plain text
860 * link: link to note
861 * seen: seen state: 0 or 1
862
863 ---
864
865 ### friendica/notifications/seen (POST)
866
867 Set note as seen, returns item object if possible
868
869 #### Parameters
870
871 id: id of the note to set seen
872
873 #### Return values
874
875 If the note is linked to an item, the item is returned, just like one of the "statuses/*_timeline" api.
876
877 If the note is not linked to an item, a success status is returned:
878
879 * `success` (json) | `<status>success</status>` (xml)
880
881 ---
882
883 ### friendica/photo (*; AUTH)
884
885 #### Parameters
886
887 * photo_id: Resource id of a photo.
888 * scale: (optional) scale value of the photo
889
890 Returns data of a picture with the given resource.
891 If 'scale' isn't provided, returned data include full url to each scale of the photo.
892 If 'scale' is set, returned data include image data base64 encoded.
893
894 possibile scale value are:
895
896 * 0: original or max size by server settings
897 * 1: image with or height at <= 640
898 * 2: image with or height at <= 320
899 * 3: thumbnail 160x160
900 * 4: Profile image at 175x175
901 * 5: Profile image at 80x80
902 * 6: Profile image at 48x48
903
904 An image used as profile image has only scale 4-6, other images only 0-3
905
906 #### Return values
907
908 json:
909
910 ```json
911         {
912                 "id": "photo id"
913                 "created": "date(YYYY-MM-DD HH:MM:SS)",
914                 "edited": "date(YYYY-MM-DD HH:MM:SS)",
915                 "title": "photo title",
916                 "desc": "photo description",
917                 "album": "album name",
918                 "filename": "original file name",
919                 "type": "mime type",
920                 "height": "number",
921                 "width": "number",
922                 "profile": "1 if is profile photo",
923                 "link": {
924                         "<scale>": "url to image"
925                         ...
926                 },
927                 // if 'scale' is set
928                 "datasize": "size in byte",
929                 "data": "base64 encoded image data"
930         }
931 ```
932
933 xml:
934
935 ```xml
936         <photo>
937                 <id>photo id</id>
938                 <created>date(YYYY-MM-DD HH:MM:SS)</created>
939                 <edited>date(YYYY-MM-DD HH:MM:SS)</edited>
940                 <title>photo title</title>
941                 <desc>photo description</desc>
942                 <album>album name</album>
943                 <filename>original file name</filename>
944                 <type>mime type</type>
945                 <height>number</height>
946                 <width>number</width>
947                 <profile>1 if is profile photo</profile>
948                 <links type="array">
949                 <link type="mime type" scale="scale number" href="image url"/>
950                         ...
951                 </links>
952         </photo>
953 ```
954
955 ---
956
957 ### friendica/photos/list (*; AUTH)
958
959 Returns a list of all photo resources of the logged in user.
960
961 #### Return values
962
963 json:
964
965 ```json
966         [
967                 {
968                         id: "resource_id",
969                         album: "album name",
970                         filename: "original file name",
971                         type: "image mime type",
972                         thumb: "url to thumb sized image"
973                 },
974                 ...
975         ]
976 ```
977
978 xml:
979
980 ```xml
981         <photos type="array">
982                 <photo id="resource_id"
983                 album="album name"
984                 filename="original file name"
985                 type="image mime type">
986                         "url to thumb sized image"
987                 </photo>
988                 ...
989         </photos>
990 ```
991
992 ---
993
994 ### friendica/photoalbum/delete (POST,DELETE; AUTH)
995
996 #### Parameters
997
998 * album: name of the album to be deleted
999
1000 deletes all images with the specified album name, is not reversible -> ensure that client is asking user for being sure to do this
1001
1002 #### Return values
1003
1004 On success:
1005
1006 * JSON return {"result":"deleted","message":"album 'xyz' with all containing photos has been deleted."}
1007
1008 On error:
1009
1010 * 403 FORBIDDEN: if not authenticated
1011 * 400 BADREQUEST: "no albumname specified", "album not available"
1012 * 500 INTERNALSERVERERROR: "problem with deleting item occured", "unknown error - deleting from database failed"
1013
1014 ---
1015
1016 ### friendica/photoalbum/update (POST,PUT; AUTH)
1017
1018 #### Parameters
1019
1020 * album: name of the album to be updated
1021 * album_new: new name of the album
1022
1023 changes the album name to album_new for all photos in album
1024
1025 #### Return values
1026
1027 On success:
1028
1029 * JSON return {"result":"updated","message":"album 'abc' with all containing photos has been renamed to 'xyz'."}
1030
1031 On error:
1032
1033 * 403 FORBIDDEN: if not authenticated
1034 * 400 BADREQUEST: "no albumname specified", "no new albumname specified", "album not available"
1035 * 500 INTERNALSERVERERROR: "unknown error - updating in database failed"
1036
1037 ---
1038
1039 ### friendica/photo/create (POST; AUTH)
1040
1041 ### friendica/photo/update (POST; AUTH)
1042
1043 #### Parameters
1044
1045 * photo_id (optional): if specified the photo with this id will be updated
1046 * media (optional): image data as base64, only optional if photo_id is specified (new upload must have media)
1047 * desc (optional): description for the photo, updated when photo_id is specified
1048 * album: name of the album to be deleted (always necessary)
1049 * album_new (optional): can be used to change the album of a single photo if photo_id is specified
1050 * allow_cid/allow_gid/deny_cid/deny_gid (optional): on create: empty string or omitting = public photo, specify in format '```<x><y><z>```' for private photo;
1051                         on update: keys need to be present with empty values for changing a private photo to public
1052
1053 both calls point to one function for creating AND updating photos.
1054 Saves data for the scales 0-2 to database (see above for scale description).
1055 Call adds non-visible entries to items table to enable authenticated contacts to comment/like the photo.
1056 Client should pay attention to the fact that updated access rights are not transferred to the contacts. i.e. public photos remain publicly visible if they have been commented/liked before setting visibility back to a limited group.
1057 Currently it is best to inform user that updating rights is not the right way to do this, and offer a solution to add photo as a new photo with the new rights instead.
1058
1059 #### Return values
1060
1061 On success:
1062
1063 * new photo uploaded: JSON return with photo data (see friendica/photo)
1064 * photo updated - changed photo data: JSON return with photo data (see friendica/photo)
1065 * photo updated - changed info: JSON return {"result":"updated","message":"Image id 'xyz' has been updated."}
1066 * photo updated - nothing changed: JSON return {"result":"cancelled","message":"Nothing to update for image id 'xyz'."}
1067
1068 On error:
1069
1070 * 403 FORBIDDEN: if not authenticated
1071 * 400 BADREQUEST: "no albumname specified", "no media data submitted", "photo not available", "acl data invalid"
1072 * 500 INTERNALSERVERERROR: "image size exceeds PHP config settings, file was rejected by server",
1073                         "image size exceeds Friendica Config setting (uploaded size: x)",
1074                         "unable to process image data",
1075                         "image upload failed",
1076                         "unknown error - uploading photo failed, see Friendica log for more information",
1077                         "unknown error - update photo entry in database failed",
1078                         "unknown error - this error on uploading or updating a photo should never happen"
1079
1080 ---
1081
1082 ### friendica/photo/delete (DELETE; AUTH)
1083
1084 #### Parameters
1085
1086 * photo_id: id of the photo to be deleted
1087
1088 deletes a single image with the specified id, is not reversible -> ensure that client is asking user for being sure to do this
1089 Sets item table entries for this photo to deleted = 1
1090
1091 #### Return values
1092
1093 On success:
1094
1095 * JSON return {"result":"deleted","message":"photo with id 'xyz' has been deleted from server."}
1096
1097 On error:
1098
1099 * 403 FORBIDDEN: if not authenticated
1100 * 400 BADREQUEST: "no photo_id specified", "photo not available"
1101 * 500 INTERNALSERVERERROR: "unknown error on deleting photo", "problem with deleting items occurred"
1102
1103 ---
1104
1105 ### friendica/direct_messages_setseen (GET; AUTH)
1106
1107 #### Parameters
1108
1109 * id: id of the message to be updated as seen
1110
1111 #### Return values
1112
1113 On success:
1114
1115 * JSON return {"result":"ok","message":"message set to seen"}
1116
1117 On error:
1118
1119 * different JSON returns {"result":"error","message":"xyz"}
1120
1121 ---
1122
1123 ### friendica/direct_messages_search (GET; AUTH)
1124
1125 #### Parameters
1126
1127 * searchstring: string for which the API call should search as '%searchstring%' in field 'body' of all messages of the authenticated user (caption ignored)
1128
1129 #### Return values
1130
1131 Returns only tested with JSON, XML might work as well.
1132
1133 On success:
1134
1135 * JSON return {"success":"true","search_results": array of found messages}
1136 * JSOn return {"success":"false","search_results":"nothing found"}
1137
1138 On error:
1139
1140 * different JSON returns {"result":"error","message":"searchstring not specified"}
1141
1142 ---
1143
1144 ### friendica/profile/show (GET; AUTH)
1145
1146 show data of all profiles or a single profile of the authenticated user
1147
1148 #### Parameters
1149
1150 * profile_id: id of the profile to be returned (optional, if omitted all profiles are returned by default)
1151
1152 #### Return values
1153
1154 On success: Array of:
1155
1156 * multi_profiles: true if user has activated multi_profiles
1157 * global_dir: URL of the global directory set in server settings
1158 * friendica_owner: user data of the authenticated user
1159 * profiles: array of the profile data
1160
1161 On error:
1162 HTTP 403 Forbidden: when no authentication was provided
1163 HTTP 400 Bad Request: if given profile_id is not in the database or is not assigned to the authenticated user
1164
1165 General description of profile data in API returns:
1166
1167 * profile_id
1168 * profile_name
1169 * is_default: true if this is the public profile
1170 * hide_friends: true if friends are hidden
1171 * profile_photo
1172 * profile_thumb
1173 * publish: true if published on the server's local directory
1174 * net_publish: true if published to global_dir
1175 * description ... homepage: different data fields from 'profile' table in database
1176 * users: array with the users allowed to view this profile (empty if is_default=true)
1177
1178 ---
1179
1180 ## Not Implemented API calls
1181
1182 The following API calls are implemented in GNU Social but not in Friendica: (incomplete)
1183
1184 * statuses/retweets_of_me
1185 * friendships/create
1186 * friendships/destroy
1187 * friendships/exists
1188 * friendships/show
1189 * account/update_profile_background_image
1190 * blocks/create
1191 * blocks/destroy
1192
1193 The following API calls from the Twitter API are not implemented in either Friendica or GNU Social:
1194
1195 * statuses/mentions_timeline
1196 * statuses/retweets/:id
1197 * statuses/oembed
1198 * statuses/retweeters/ids
1199 * statuses/lookup
1200 * direct_messages/show
1201 * friendships/no_retweets/ids
1202 * friendships/outgoing
1203 * friendships/update
1204 * friends/list
1205 * friendships/lookup
1206 * account/settings
1207 * account/update_delivery_device
1208 * account/update_profile
1209 * blocks/ids
1210 * users/show
1211 * users/search
1212 * account/remove_profile_banner
1213 * account/update_profile_banner
1214 * users/profile_banner
1215 * mutes/users/create
1216 * mutes/users/destroy
1217 * mutes/users/ids
1218 * mutes/users/list
1219 * users/suggestions/:slug
1220 * users/suggestions
1221 * users/suggestions/:slug/members
1222 * favorites/list
1223 * lists/list
1224 * lists/statuses
1225 * lists/members/destroy
1226 * lists/memberships
1227 * lists/subscribers
1228 * lists/subscribers/create
1229 * lists/subscribers/show
1230 * lists/subscribers/destroy
1231 * lists/members/create_all
1232 * lists/members/show
1233 * lists/members
1234 * lists/members/create
1235 * lists/destroy
1236 * lists/update
1237 * lists/create
1238 * lists/show
1239 * lists/subscriptions
1240 * lists/members/destroy_all
1241 * lists/ownerships
1242 * saved_searches/show/:id
1243 * saved_searches/create
1244 * saved_searches/destroy/:id
1245 * geo/id/:place_id
1246 * geo/reverse_geocode
1247 * geo/search
1248 * geo/place
1249 * trends/place
1250 * trends/available
1251 * help/configuration
1252 * help/languages
1253 * help/privacy
1254 * help/tos
1255 * trends/closest
1256 * users/report_spam
1257
1258 ---
1259
1260 ---
1261
1262 ## Usage Examples
1263
1264 ### BASH / cURL
1265
1266 ```bash
1267 /usr/bin/curl -u USER:PASS https://YOUR.FRIENDICA.TLD/api/statuses/update.xml -d source="some source id" -d status="the status you want to post"
1268 ```
1269
1270 ### Python
1271
1272 The [RSStoFriendika](https://github.com/pafcu/RSStoFriendika) code can be used as an example of how to use the API with python.
1273 The lines for posting are located at [line 21](https://github.com/pafcu/RSStoFriendika/blob/master/RSStoFriendika.py#L21) and following.
1274
1275 def tweet(server, message, group_allow=None):
1276 url = server + '/api/statuses/update'
1277 urllib2.urlopen(url, urllib.urlencode({'status': message,'group_allow[]':group_allow}, doseq=True))
1278
1279 There is also a [module for python 3](https://bitbucket.org/tobiasd/python-friendica) for using the API.