]> git.mxchange.org Git - friendica.git/blob - doc/api.md
Fixed E_NOTICE when no valid result has been returned. (#5457)
[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 ### lists/ownerships (*; AUTH)
298
299 #### Parameters
300
301 * list_id: ID of the list
302 * count: Items per page
303 * page: Page number
304 * since_id: Minimum ID
305 * max_id: Maximum ID
306
307 #### Unsupported parameters
308
309 * slug
310 * owner_screen_name
311 * owner_id
312 * include_entities
313 * include_rts
314
315 ---
316
317 ### lists/destroy (POST; AUTH)
318
319 #### Parameters
320
321 * list_id: ID of the list
322
323 #### Unsupported parameters
324
325 * owner_screen_name
326 * owner_id
327 * slug
328
329 ---
330
331 ### lists/create (POST; AUTH)
332
333 #### Parameters
334
335 * name: name of the list
336
337 #### Unsupported parameters
338
339 * mode
340 * description
341
342 ---
343
344 ### lists/update (POST; AUTH)
345
346 #### Parameters
347
348 * list_id: ID of the list
349 * name: name of the list
350
351 #### Unsupported parameters
352
353 * slug
354 * name
355 * mode
356 * description
357 * owner_screen_name
358 * owner_id
359
360 ---
361
362 ### lists/statuses (*; AUTH)
363
364 #### Parameters
365
366 * user_id: ID of the user for whom to return results.
367
368 #### Unsupported parameters
369
370 * screen_name
371 * count
372 * cursor
373
374 ---
375
376 ### media/upload (POST,PUT; AUTH)
377
378 #### Parameters
379
380 * media: image data
381
382 ---
383
384 ### oauth/request_token (*)
385
386 #### Parameters
387
388 * oauth_callback
389
390 #### Unsupported parameters
391
392 * x_auth_access_type
393
394 ---
395
396 ### oauth/access_token (*)
397
398 #### Parameters
399
400 * oauth_verifier
401
402 #### Unsupported parameters
403
404 * x_auth_password
405 * x_auth_username
406 * x_auth_mode
407
408 ---
409
410 ### statuses/destroy (POST,DELETE; AUTH)
411
412 #### Parameters
413
414 * id: message number
415 * include_entities: "true" shows entities for pictures and links (Default: false)
416
417 #### Unsupported parameters
418
419 * trim_user
420
421 ---
422
423 ### statuses/followers (*; AUTH)
424
425 #### Parameters
426
427 * include_entities: "true" shows entities for pictures and links (Default: false)
428
429 ---
430
431 ### statuses/friends (*; AUTH)
432
433 #### Parameters
434
435 * include_entities: "true" shows entities for pictures and links (Default: false)
436 * count: how many items should be shown (Default: 20)
437
438 ---
439
440 ### blocks/list (*; AUTH)
441
442 #### Parameters
443
444 * include_entities: "true" shows entities for pictures and links (Default: false)
445 * count: Items per page (default: 20).
446 * page: page number
447
448 #### Unsupported parameters
449
450 * cursor
451 * skip_status
452
453 ---
454
455 ### statuses/friends_timeline (*; AUTH)
456
457 #### Parameters
458
459 * count: Items per page (default: 20)
460 * page: page number
461 * since_id: minimum id
462 * max_id: maximum id
463 * exclude_replies: don't show replies (default: false)
464 * conversation_id: Shows all statuses of a given conversation.
465 * include_entities: "true" shows entities for pictures and links (Default: false)
466
467 #### Unsupported parameters
468
469 * include_rts
470 * trim_user
471 * contributor_details
472
473 ---
474
475 ### statuses/home_timeline (*; AUTH)
476
477 #### Parameters
478
479 * count: Items per page (default: 20)
480 * page: page number
481 * since_id: minimum id
482 * max_id: maximum id
483 * exclude_replies: don't show replies (default: false)
484 * conversation_id: Shows all statuses of a given conversation.
485 * include_entities: "true" shows entities for pictures and links (Default: false)
486
487 #### Unsupported parameters
488
489 * include_rts
490 * trim_user
491 * contributor_details
492
493 ---
494
495 ### statuses/mentions (*; AUTH)
496
497 #### Parameters
498
499 * count: Items per page (default: 20)
500 * page: page number
501 * since_id: minimum id
502 * max_id: maximum id
503 * include_entities: "true" shows entities for pictures and links (Default: false)
504
505 #### Unsupported parameters
506
507 * include_rts
508 * trim_user
509 * contributor_details
510
511 ---
512
513 ### statuses/public_timeline (*; AUTH)
514
515 #### Parameters
516
517 * count: Items per page (default: 20)
518 * page: page number
519 * since_id: minimum id
520 * max_id: maximum id
521 * exclude_replies: don't show replies (default: false)
522 * conversation_id: Shows all statuses of a given conversation.
523 * include_entities: "true" shows entities for pictures and links (Default: false)
524
525 #### Unsupported parameters
526
527 * trim_user
528
529 ---
530
531 ### statuses/networkpublic_timeline (*; AUTH)
532
533 #### Parameters
534
535 * count: Items per page (default: 20)
536 * page: page number
537 * since_id: minimum id
538 * max_id: maximum id
539 * include_entities: "true" shows entities for pictures and links (Default: false)
540
541 ---
542
543 ### statuses/replies (*; AUTH)
544
545 #### Parameters
546
547 * count: Items per page (default: 20)
548 * page: page number
549 * since_id: minimum id
550 * max_id: maximum id
551 * include_entities: "true" shows entities for pictures and links (Default: false)
552
553 #### Unsupported parameters
554
555 * include_rts
556 * trim_user
557 * contributor_details
558
559 ---
560
561 ### statuses/retweet (POST,PUT; AUTH)
562
563 #### Parameters
564
565 * id: message number
566 * include_entities: "true" shows entities for pictures and links (Default: false)
567
568 #### Unsupported parameters
569
570 * trim_user
571
572 ---
573
574 ### statuses/show (*; AUTH)
575
576 #### Parameters
577
578 * id: message number
579 * conversation: if set to "1" show all messages of the conversation with the given id
580 * include_entities: "true" shows entities for pictures and links (Default: false)
581
582 #### Unsupported parameters
583
584 * include_my_retweet
585 * trim_user
586
587 ---
588
589 ### statuses/update, statuses/update_with_media
590
591 #### Parameters
592
593 * title: Title of the status
594 * status: Status in text format
595 * htmlstatus: Status in HTML format
596 * in_reply_to_status_id
597 * lat: latitude
598 * long: longitude
599 * media: image data
600 * source: Application name
601 * group_allow
602 * contact_allow
603 * group_deny
604 * contact_deny
605 * network
606 * include_entities: "true" shows entities for pictures and links (Default: false)
607 * media_ids: (By now only a single value, no array)
608
609 #### Unsupported parameters
610
611 * trim_user
612 * place_id
613 * display_coordinates
614
615 ---
616
617 ### statuses/user_timeline (*; AUTH)
618
619 #### Parameters
620
621 * user_id: id of the user
622 * screen_name: screen name (for technical reasons, this value is not unique!)
623 * count: Items per page (default: 20)
624 * page: page number
625 * since_id: minimum id
626 * max_id: maximum id
627 * exclude_replies: don't show replies (default: false)
628 * conversation_id: Shows all statuses of a given conversation.
629 * include_entities: "true" shows entities for pictures and links (Default: false)
630
631 #### Unsupported parameters
632
633 * include_rts
634 * trim_user
635 * contributor_details
636
637 ---
638
639 ### statusnet/config (*)
640
641 ---
642
643 ### statusnet/conversation (*; AUTH)
644
645 It shows all direct answers (excluding the original post) to a given id.
646
647 #### Parameter
648
649 * id: id of the post
650 * count: Items per page (default: 20)
651 * page: page number
652 * since_id: minimum id
653 * max_id: maximum id
654 * include_entities: "true" shows entities for pictures and links (Default: false)
655
656 ---
657
658 ### statusnet/version (*)
659
660 #### Unsupported parameters
661
662 * user_id
663 * screen_name
664 * cursor
665
666 Friendica doesn't allow showing followers of other users.
667
668 ---
669
670 ### search (*; AUTH)
671
672 #### Parameters
673
674 * q: search query
675 * page: the page number (starting at 1) to return
676 * rpp: the number of statuses to return per page
677 * count: alias for the rpp parameter
678 * since_id: returns statuses with ids greater than the given id
679 * max_id: returns statuses with ids lower or equal to the given id
680
681 #### Unsupported parameters
682
683 * geocode
684 * lang
685 * locale
686 * result_type
687 * until
688 * include_entities
689
690 ---
691
692 ### search/tweets (*; AUTH)
693
694 This is an alias for `search`.
695
696 ---
697
698 ### saved_searches/list (*; AUTH)
699
700 This call does not have any parameter.
701
702 ---
703
704 ### users/search (*)
705
706 #### Parameters
707
708 * q: name of the user
709
710 #### Unsupported parameters
711
712 * page
713 * count
714 * include_entities
715
716 ---
717
718 ### users/show (*)
719
720 #### Parameters
721
722 * user_id: id of the user
723 * screen_name: screen name (for technical reasons, this value is not unique!)
724 * include_entities: "true" shows entities for pictures and links (Default: false)
725
726 #### Unsupported parameters
727
728 * user_id
729 * screen_name
730 * cursor
731
732 Friendica doesn't allow showing friends of other users.
733
734 ---
735
736 ### users/lookup (*; AUTH)
737
738 #### Parameters
739
740 * user_id: list of ids to lookup
741
742 #### Unsupported parameters
743
744 * screen_name
745 * include_entities
746
747 ---
748
749 ### account/update_profile_image (POST; AUTH)
750
751 #### Parameters
752
753 * image: image data as base64 (Twitter has a limit of 700kb, Friendica allows more)
754 * profile_id (optional): id of the profile for which the image should be used, default is changing the default profile
755
756 uploads a new profile image (scales 4-6) to database, changes default or specified profile to the new photo
757
758 #### Return values
759
760 On success:
761
762 * JSON return: returns the updated user details (see account/verify_credentials)
763
764 On error:
765
766 * 403 FORBIDDEN: if not authenticated
767 * 400 BADREQUEST: "no media data submitted", "profile_id not available"
768 * 500 INTERNALSERVERERROR: "image size exceeds PHP config settings, file was rejected by server",
769                         "image size exceeds Friendica Config setting (uploaded size: x)",
770                         "unable to process image data",
771                         "image upload failed"
772
773 ---
774
775 ### account/update_profile (POST; AUTH)
776
777 #### Parameters
778
779 * name (optional): full name of the user
780 * description (optional): a description of the user
781
782 #### Unsupported parameters
783
784 * url
785 * location
786 * profile_link_color
787 * include_entities
788 * skip_status
789
790 ---
791
792 ### friendships/incoming (*; AUTH)
793
794 #### Unsupported parameters
795
796 * cursor
797 * stringify_ids
798
799 ## Implemented API calls (not compatible with other APIs)
800
801 ---
802
803 ### friendica/activity/[verb]
804
805 #### parameters
806
807 * id: item id
808
809 Add or remove an activity from an item.
810 'verb' can be one of:
811
812 * like
813 * dislike
814 * attendyes
815 * attendno
816 * attendmaybe
817
818 To remove an activity, prepend the verb with "un", eg. "unlike" or "undislike"
819 Attend verbs disable eachother: that means that if "attendyes" was added to an item, adding "attendno" remove previous "attendyes".
820 Attend verbs should be used only with event-related items (there is no check at the moment)
821
822 #### Return values
823
824 On success:
825 json:
826
827 ```"ok"```
828
829 xml:
830
831 ```<ok>true</ok>```
832
833 On error:
834 HTTP 400 BadRequest
835
836 ---
837
838 ### friendica/group_show (*; AUTH)
839
840 Return all or a specified group of the user with the containing contacts as array.
841
842 #### Parameters
843
844 * gid: optional, if not given, API returns all groups of the user
845
846 #### Return values
847
848 Array of:
849
850 * name: name of the group
851 * gid: id of the group
852 * user: array of group members (return from api_get_user() function for each member)
853
854 ---
855
856 ### friendica/group_delete (POST,DELETE; AUTH)
857
858 delete the specified group of contacts; API call need to include the correct gid AND name of the group to be deleted.
859
860 #### Parameters
861
862 * gid: id of the group to be deleted
863 * name: name of the group to be deleted
864
865 #### Return values
866
867 Array of:
868
869 * success: true if successfully deleted
870 * gid: gid of the deleted group
871 * name: name of the deleted group
872 * status: â€ždeleted“ if successfully deleted
873 * wrong users: empty array
874
875 ---
876
877 ### friendica/group_create (POST,PUT; AUTH)
878
879 Create the group with the posted array of contacts as members.
880
881 #### Parameters
882
883 * name: name of the group to be created
884
885 #### POST data
886
887 JSON data as Array like the result of "users/group_show":
888
889 * gid
890 * name
891 * array of users
892
893 #### Return values
894
895 Array of:
896
897 * success: true if successfully created or reactivated
898 * gid: gid of the created group
899 * name: name of the created group
900 * status: â€žmissing user“ | â€žreactivated“ | â€žok“
901 * wrong users: array of users, which were not available in the contact table
902
903 ---
904
905 ### friendica/group_update (POST)
906
907 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).
908
909 #### Parameters
910
911 * gid: id of the group to be changed
912 * name: name of the group to be changed
913
914 #### POST data
915
916 JSON data as array like the result of â€žusers/group_show“:
917
918 * gid
919 * name
920 * array of users
921
922 #### Return values
923
924 Array of:
925
926 * success: true if successfully updated
927 * gid: gid of the changed group
928 * name: name of the changed group
929 * status: â€žmissing user“ | â€žok“
930 * wrong users: array of users, which were not available in the contact table
931
932 ---
933
934 ### friendica/notifications (GET)
935
936 Return last 50 notification for current user, ordered by date with unseen item on top
937
938 #### Parameters
939
940 none
941
942 #### Return values
943
944 Array of:
945
946 * id: id of the note
947 * type: type of notification as int (see NOTIFY_* constants in boot.php)
948 * name: full name of the contact subject of the note
949 * url: contact's profile url
950 * photo: contact's profile photo
951 * date: datetime string of the note
952 * timestamp: timestamp of the node
953 * date_rel: relative date of the note (eg. "1 hour ago")
954 * msg: note message in bbcode
955 * msg_html: note message in html
956 * msg_plain: note message in plain text
957 * link: link to note
958 * seen: seen state: 0 or 1
959
960 ---
961
962 ### friendica/notifications/seen (POST)
963
964 Set note as seen, returns item object if possible
965
966 #### Parameters
967
968 id: id of the note to set seen
969
970 #### Return values
971
972 If the note is linked to an item, the item is returned, just like one of the "statuses/*_timeline" api.
973
974 If the note is not linked to an item, a success status is returned:
975
976 * `success` (json) | `<status>success</status>` (xml)
977
978 ---
979
980 ### friendica/photo (*; AUTH)
981
982 #### Parameters
983
984 * photo_id: Resource id of a photo.
985 * scale: (optional) scale value of the photo
986
987 Returns data of a picture with the given resource.
988 If 'scale' isn't provided, returned data include full url to each scale of the photo.
989 If 'scale' is set, returned data include image data base64 encoded.
990
991 possibile scale value are:
992
993 * 0: original or max size by server settings
994 * 1: image with or height at <= 640
995 * 2: image with or height at <= 320
996 * 3: thumbnail 160x160
997 * 4: Profile image at 175x175
998 * 5: Profile image at 80x80
999 * 6: Profile image at 48x48
1000
1001 An image used as profile image has only scale 4-6, other images only 0-3
1002
1003 #### Return values
1004
1005 json:
1006
1007 ```json
1008         {
1009                 "id": "photo id"
1010                 "created": "date(YYYY-MM-DD HH:MM:SS)",
1011                 "edited": "date(YYYY-MM-DD HH:MM:SS)",
1012                 "title": "photo title",
1013                 "desc": "photo description",
1014                 "album": "album name",
1015                 "filename": "original file name",
1016                 "type": "mime type",
1017                 "height": "number",
1018                 "width": "number",
1019                 "profile": "1 if is profile photo",
1020                 "link": {
1021                         "<scale>": "url to image"
1022                         ...
1023                 },
1024                 // if 'scale' is set
1025                 "datasize": "size in byte",
1026                 "data": "base64 encoded image data"
1027         }
1028 ```
1029
1030 xml:
1031
1032 ```xml
1033         <photo>
1034                 <id>photo id</id>
1035                 <created>date(YYYY-MM-DD HH:MM:SS)</created>
1036                 <edited>date(YYYY-MM-DD HH:MM:SS)</edited>
1037                 <title>photo title</title>
1038                 <desc>photo description</desc>
1039                 <album>album name</album>
1040                 <filename>original file name</filename>
1041                 <type>mime type</type>
1042                 <height>number</height>
1043                 <width>number</width>
1044                 <profile>1 if is profile photo</profile>
1045                 <links type="array">
1046                 <link type="mime type" scale="scale number" href="image url"/>
1047                         ...
1048                 </links>
1049         </photo>
1050 ```
1051
1052 ---
1053
1054 ### friendica/photos/list (*; AUTH)
1055
1056 Returns a list of all photo resources of the logged in user.
1057
1058 #### Return values
1059
1060 json:
1061
1062 ```json
1063         [
1064                 {
1065                         id: "resource_id",
1066                         album: "album name",
1067                         filename: "original file name",
1068                         type: "image mime type",
1069                         thumb: "url to thumb sized image"
1070                 },
1071                 ...
1072         ]
1073 ```
1074
1075 xml:
1076
1077 ```xml
1078         <photos type="array">
1079                 <photo id="resource_id"
1080                 album="album name"
1081                 filename="original file name"
1082                 type="image mime type">
1083                         "url to thumb sized image"
1084                 </photo>
1085                 ...
1086         </photos>
1087 ```
1088
1089 ---
1090
1091 ### friendica/photoalbum/delete (POST,DELETE; AUTH)
1092
1093 #### Parameters
1094
1095 * album: name of the album to be deleted
1096
1097 deletes all images with the specified album name, is not reversible -> ensure that client is asking user for being sure to do this
1098
1099 #### Return values
1100
1101 On success:
1102
1103 * JSON return {"result":"deleted","message":"album 'xyz' with all containing photos has been deleted."}
1104
1105 On error:
1106
1107 * 403 FORBIDDEN: if not authenticated
1108 * 400 BADREQUEST: "no albumname specified", "album not available"
1109 * 500 INTERNALSERVERERROR: "problem with deleting item occured", "unknown error - deleting from database failed"
1110
1111 ---
1112
1113 ### friendica/photoalbum/update (POST,PUT; AUTH)
1114
1115 #### Parameters
1116
1117 * album: name of the album to be updated
1118 * album_new: new name of the album
1119
1120 changes the album name to album_new for all photos in album
1121
1122 #### Return values
1123
1124 On success:
1125
1126 * JSON return {"result":"updated","message":"album 'abc' with all containing photos has been renamed to 'xyz'."}
1127
1128 On error:
1129
1130 * 403 FORBIDDEN: if not authenticated
1131 * 400 BADREQUEST: "no albumname specified", "no new albumname specified", "album not available"
1132 * 500 INTERNALSERVERERROR: "unknown error - updating in database failed"
1133
1134 ---
1135
1136 ### friendica/photo/create (POST; AUTH)
1137
1138 ### friendica/photo/update (POST; AUTH)
1139
1140 #### Parameters
1141
1142 * photo_id (optional): if specified the photo with this id will be updated
1143 * media (optional): image data as base64, only optional if photo_id is specified (new upload must have media)
1144 * desc (optional): description for the photo, updated when photo_id is specified
1145 * album: name of the album to be deleted (always necessary)
1146 * album_new (optional): can be used to change the album of a single photo if photo_id is specified
1147 * 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;
1148                         on update: keys need to be present with empty values for changing a private photo to public
1149
1150 both calls point to one function for creating AND updating photos.
1151 Saves data for the scales 0-2 to database (see above for scale description).
1152 Call adds non-visible entries to items table to enable authenticated contacts to comment/like the photo.
1153 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.
1154 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.
1155
1156 #### Return values
1157
1158 On success:
1159
1160 * new photo uploaded: JSON return with photo data (see friendica/photo)
1161 * photo updated - changed photo data: JSON return with photo data (see friendica/photo)
1162 * photo updated - changed info: JSON return {"result":"updated","message":"Image id 'xyz' has been updated."}
1163 * photo updated - nothing changed: JSON return {"result":"cancelled","message":"Nothing to update for image id 'xyz'."}
1164
1165 On error:
1166
1167 * 403 FORBIDDEN: if not authenticated
1168 * 400 BADREQUEST: "no albumname specified", "no media data submitted", "photo not available", "acl data invalid"
1169 * 500 INTERNALSERVERERROR: "image size exceeds PHP config settings, file was rejected by server",
1170                         "image size exceeds Friendica Config setting (uploaded size: x)",
1171                         "unable to process image data",
1172                         "image upload failed",
1173                         "unknown error - uploading photo failed, see Friendica log for more information",
1174                         "unknown error - update photo entry in database failed",
1175                         "unknown error - this error on uploading or updating a photo should never happen"
1176
1177 ---
1178
1179 ### friendica/photo/delete (DELETE; AUTH)
1180
1181 #### Parameters
1182
1183 * photo_id: id of the photo to be deleted
1184
1185 deletes a single image with the specified id, is not reversible -> ensure that client is asking user for being sure to do this
1186 Sets item table entries for this photo to deleted = 1
1187
1188 #### Return values
1189
1190 On success:
1191
1192 * JSON return {"result":"deleted","message":"photo with id 'xyz' has been deleted from server."}
1193
1194 On error:
1195
1196 * 403 FORBIDDEN: if not authenticated
1197 * 400 BADREQUEST: "no photo_id specified", "photo not available"
1198 * 500 INTERNALSERVERERROR: "unknown error on deleting photo", "problem with deleting items occurred"
1199
1200 ---
1201
1202 ### friendica/direct_messages_setseen (GET; AUTH)
1203
1204 #### Parameters
1205
1206 * id: id of the message to be updated as seen
1207
1208 #### Return values
1209
1210 On success:
1211
1212 * JSON return {"result":"ok","message":"message set to seen"}
1213
1214 On error:
1215
1216 * different JSON returns {"result":"error","message":"xyz"}
1217
1218 ---
1219
1220 ### friendica/direct_messages_search (GET; AUTH)
1221
1222 #### Parameters
1223
1224 * searchstring: string for which the API call should search as '%searchstring%' in field 'body' of all messages of the authenticated user (caption ignored)
1225
1226 #### Return values
1227
1228 Returns only tested with JSON, XML might work as well.
1229
1230 On success:
1231
1232 * JSON return {"success":"true","search_results": array of found messages}
1233 * JSOn return {"success":"false","search_results":"nothing found"}
1234
1235 On error:
1236
1237 * different JSON returns {"result":"error","message":"searchstring not specified"}
1238
1239 ---
1240
1241 ### friendica/profile/show (GET; AUTH)
1242
1243 show data of all profiles or a single profile of the authenticated user
1244
1245 #### Parameters
1246
1247 * profile_id: id of the profile to be returned (optional, if omitted all profiles are returned by default)
1248
1249 #### Return values
1250
1251 On success: Array of:
1252
1253 * multi_profiles: true if user has activated multi_profiles
1254 * global_dir: URL of the global directory set in server settings
1255 * friendica_owner: user data of the authenticated user
1256 * profiles: array of the profile data
1257
1258 On error:
1259 HTTP 403 Forbidden: when no authentication was provided
1260 HTTP 400 Bad Request: if given profile_id is not in the database or is not assigned to the authenticated user
1261
1262 General description of profile data in API returns:
1263
1264 * profile_id
1265 * profile_name
1266 * is_default: true if this is the public profile
1267 * hide_friends: true if friends are hidden
1268 * profile_photo
1269 * profile_thumb
1270 * publish: true if published on the server's local directory
1271 * net_publish: true if published to global_dir
1272 * description ... homepage: different data fields from 'profile' table in database
1273 * users: array with the users allowed to view this profile (empty if is_default=true)
1274
1275 ---
1276
1277 ## Not Implemented API calls
1278
1279 The following API calls are implemented in GNU Social but not in Friendica: (incomplete)
1280
1281 * statuses/retweets_of_me
1282 * friendships/create
1283 * friendships/destroy
1284 * friendships/exists
1285 * friendships/show
1286 * account/update_profile_background_image
1287 * blocks/create
1288 * blocks/destroy
1289
1290 The following API calls from the Twitter API are not implemented in either Friendica or GNU Social:
1291
1292 * statuses/mentions_timeline
1293 * statuses/retweets/:id
1294 * statuses/oembed
1295 * statuses/retweeters/ids
1296 * statuses/lookup
1297 * direct_messages/show
1298 * friendships/no_retweets/ids
1299 * friendships/outgoing
1300 * friendships/update
1301 * friends/list
1302 * friendships/lookup
1303 * account/settings
1304 * account/update_delivery_device
1305 * blocks/ids
1306 * users/show
1307 * users/search
1308 * account/remove_profile_banner
1309 * account/update_profile_banner
1310 * users/profile_banner
1311 * mutes/users/create
1312 * mutes/users/destroy
1313 * mutes/users/ids
1314 * mutes/users/list
1315 * users/suggestions/:slug
1316 * users/suggestions
1317 * users/suggestions/:slug/members
1318 * favorites/list
1319 * lists/list
1320 * lists/members/destroy
1321 * lists/memberships
1322 * lists/subscribers
1323 * lists/subscribers/create
1324 * lists/subscribers/show
1325 * lists/subscribers/destroy
1326 * lists/members/create_all
1327 * lists/members/show
1328 * lists/members
1329 * lists/members/create
1330 * lists/show
1331 * lists/subscriptions
1332 * lists/members/destroy_all
1333 * saved_searches/show/:id
1334 * saved_searches/create
1335 * saved_searches/destroy/:id
1336 * geo/id/:place_id
1337 * geo/reverse_geocode
1338 * geo/search
1339 * geo/place
1340 * trends/place
1341 * trends/available
1342 * help/configuration
1343 * help/languages
1344 * help/privacy
1345 * help/tos
1346 * trends/closest
1347 * users/report_spam
1348
1349 ---
1350
1351 ---
1352
1353 ## Usage Examples
1354
1355 ### BASH / cURL
1356
1357 ```bash
1358 /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"
1359 ```
1360
1361 ### Python
1362
1363 The [RSStoFriendika](https://github.com/pafcu/RSStoFriendika) code can be used as an example of how to use the API with python.
1364 The lines for posting are located at [line 21](https://github.com/pafcu/RSStoFriendika/blob/master/RSStoFriendika.py#L21) and following.
1365
1366 def tweet(server, message, group_allow=None):
1367 url = server + '/api/statuses/update'
1368 urllib2.urlopen(url, urllib.urlencode({'status': message,'group_allow[]':group_allow}, doseq=True))
1369
1370 There is also a [module for python 3](https://bitbucket.org/tobiasd/python-friendica) for using the API.