4 * [Using the APIs](help/api)
8 Friendica provides the following specific endpoints.
10 Authentication is the same as described in [Using the APIs](help/api#Authentication).
14 These endpoints uses the [Friendica API entities](help/API-Entities).
18 ### GET api/friendica/events
20 Returns a list of [Event](help/API-Entities#Event) entities for the current logged in user.
24 - `since_id`: (optional) minimum event id for pagination
25 - `count`: maximum number of items returned, default 20
27 ### POST api/friendica/event_create
29 Create a new event for the current logged in user.
33 - `id` : (optional) id of event, event will be amended if supplied
34 - `name` : name of the event (required)
35 - `startTime` : start of the event (ISO), required
36 - `endTime` : (optional) end of the event, event is open end, if not supplied
37 - `desc` : (optional) description of the event
38 - `place` : (optional) location of the event
39 - `publish` : (optional) create message for event
41 ### POST api/friendica/event_delete
43 Delete event from calendar (not the message)
47 - `id` : id of event to be deleted
49 ### GET api/externalprofile/show
51 Returns a [Contact](help/API-Entities#Contact) entity for the provided profile URL.
55 - `profileurl`: Profile URL
57 ### GET api/statuses/public_timeline
59 Returns a list of public [Items](help/API-Entities#Item) posted on this node.
60 Equivalent of the local community page.
64 * `count`: Items per page (default: 20)
66 * `since_id`: minimum id
67 * `max_id`: maximum id
68 * `exclude_replies`: don't show replies (default: false)
69 * `conversation_id`: Shows all statuses of a given conversation.
70 * `include_entities`: "true" shows entities for pictures and links (Default: false)
72 #### Unsupported parameters
76 ### GET api/statuses/networkpublic_timeline
78 Returns a list of public [Items](help/API-Entities#Item) this node is aware of.
79 Equivalent of the global community page.
83 * `count`: Items per page (default: 20)
85 * `since_id`: minimum id
86 * `max_id`: maximum id
87 * `exclude_replies`: don't show replies (default: false)
88 * `conversation_id`: Shows all statuses of a given conversation.
89 * `include_entities`: "true" shows entities for pictures and links (Default: false)
91 ### GET api/statuses/replies
95 * `count`: Items per page (default: 20)
97 * `since_id`: minimum id
98 * `max_id`: maximum id
99 * `include_entities`: "true" shows entities for pictures and links (Default: false)
101 #### Unsupported parameters
105 * `contributor_details`
109 ### GET api/conversation/show
111 Unofficial Twitter command. It shows all direct answers (excluding the original post) to a given id.
115 * `id`: id of the post
116 * `count`: Items per page (default: 20)
117 * `page`: page number
118 * `since_id`: minimum id
119 * `max_id`: maximum id
120 * `include_entities`: "true" shows entities for pictures and links (Default: false)
122 #### Unsupported parameters
126 * `contributor_details`
128 ### GET api/statusnet/conversation
130 Alias of [`api/conversation/show`](#GET+api%2Fconversation%2Fshow).
132 ### GET api/statusnet/config
134 Returns the public Friendica node configuration.
136 ### GET api/gnusocial/config
138 Alias of [`api/statusnet/config`](#GET+api%2Fstatusnet%2Fconfig).
140 ### GET api/statusnet/version
142 Returns a fake static StatusNet protocol version.
144 ### GET api/gnusocial/version
146 Alias of [`api/statusnet/version`](#GET+api%2Fstatusnet%2Fversion).
150 ### POST api/friendica/activity/[verb]
152 Add or remove an activity from an item.
153 'verb' can be one of:
161 To remove an activity, prepend the verb with "un", eg. "unlike" or "undislike"
162 Attend verbs disable eachother: that means that if "attendyes" was added to an item, adding "attendno" remove previous "attendyes".
163 Attend verbs should be used only with event-related items (there is no check at the moment).
185 ### GET api/direct_messages
187 Deprecated Twitter received direct message list endpoint.
191 * `count`: Items per page (default: 20)
192 * `page`: page number
193 * `since_id`: minimum id
194 * `max_id`: maximum id
195 * `getText`: Defines the format of the status field. Can be "html" or "plain"
196 * `include_entities`: "true" shows entities for pictures and links (Default: false)
197 * `friendica_verbose`: "true" enables different error returns (default: "false")
199 #### Unsupported parameters
203 ### GET api/direct_messages/all
205 Returns all [Private Messages](help/API-Entities#Private+message).
209 * `count`: Items per page (default: 20)
210 * `page`: page number
211 * `since_id`: minimum id
212 * `max_id`: maximum id
213 * `getText`: Defines the format of the status field. Can be "html" or "plain"
214 * `friendica_verbose`: "true" enables different error returns (default: "false")
216 ### GET api/direct_messages/conversation
218 Returns all replies of a single private message conversation. Returns [Private Messages](help/API-Entities#Private+message)
222 * `count`: Items per page (default: 20)
223 * `page`: page number
224 * `since_id`: minimum id
225 * `max_id`: maximum id
226 * `getText`: Defines the format of the status field. Can be "html" or "plain"
227 * `uri`: URI of the conversation
228 * `friendica_verbose`: "true" enables different error returns (default: "false")
230 ### GET api/direct_messages/sent
232 Deprecated Twitter sent direct message list endpoint. Returns [Private Messages](help/API-Entities#Private+message).
236 * `count`: Items per page (default: 20)
237 * `page`: page number
238 * `since_id`: minimum id
239 * `max_id`: maximum id
240 * `getText`: Defines the format of the status field. Can be "html" or "plain"
241 * `include_entities`: "true" shows entities for pictures and links (Default: false)
242 * `friendica_verbose`: "true" enables different error returns (default: "false")
245 ### POST api/direct_messages/new
247 Deprecated Twitter direct message submission endpoint.
251 * `user_id`: id of the user
252 * `screen_name`: screen name (for technical reasons, this value is not unique!)
253 * `text`: The message
254 * `replyto`: ID of the replied direct message
255 * `title`: Title of the direct message
257 ### POST api/direct_messages/destroy
259 Deprecated Twitter direct message deletion endpoint.
263 * `id`: id of the message to be deleted
264 * `include_entities`: optional, currently not yet implemented
265 * `friendica_parenturi`: optional, can be used for increased safety to delete only intended messages
266 * `friendica_verbose`: "true" enables different error returns (default: "false")
272 * JSON return as defined for Twitter API not yet implemented
273 * on friendica_verbose=true: JSON return {"result":"ok","message":"message deleted"}
278 * on friendica_verbose=true: different JSON returns {"result":"error","message":"xyz"}
280 ### GET api/friendica/direct_messages_setseen
284 * `id`: id of the message to be updated as seen
290 * JSON return `{"result": "ok", "message": "message set to seen"}`
294 * different JSON returns `{"result": "error", "message": "xyz"}`
297 ### GET api/friendica/direct_messages_search (GET; AUTH)
299 Returns [Private Messages](help/API-Entities#Private+message) matching the provided search string.
303 * `searchstring`: string for which the API call should search as '%searchstring%' in field 'body' of all messages of the authenticated user (caption ignored)
304 * `getText` (optional): `plain`|`html` If ommited, the title is prepended to the plaintext body in the `text` attribute of the private message objects.
305 * `getUserObjects` (optional): `true`|`false` If `false`, the `sender` and `recipient` attributes of the private message object are absent.
309 Returns only tested with JSON, XML might work as well.
313 * JSON return `{"success":"true", "search_results": array of found messages}`
314 * JSOn return `{"success":"false", "search_results": "nothing found"}`
318 * different JSON returns `{"result": "error", "message": "searchstring not specified"}`
322 ### GET api/friendica/group_show
324 Return all or a specified group of the user with the containing contacts as array.
328 * `gid`: optional, if not given, API returns all groups of the user
334 * `name`: name of the group
335 * `gid`: id of the group
336 * `user`: array of [Contacts](help/API-Entities#Contact)
338 ### POST api/friendica/group_create
340 Create the group with the posted array of contacts as members.
344 * `name`: name of the group to be created
348 JSON data as Array like the result of [GET api/friendica/group_show](#GET+api%2Ffriendica%2Fgroup_show):
352 * List of [Contacts](help/API-Entities#Contact)
358 * `success`: true if successfully created or reactivated
359 * `gid`: gid of the created group
360 * `name`: name of the created group
361 * `status`: "missing user" | "reactivated" | "ok"
362 * `wrong users`: array of users, which were not available in the contact table
364 ### POST api/friendica/group_update
366 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).
370 * `gid`: id of the group to be changed
371 * `name`: name of the group to be changed
375 JSON data as array like the result of [GET api/friendica/group_show](#GET+api%2Ffriendica%2Fgroup_show):
379 * List of [Contacts](help/API-Entities#Contact)
385 * `success`: true if successfully updated
386 * `gid`: gid of the changed group
387 * `name`: name of the changed group
388 * `status`: "missing user" | "ok"
389 * `wrong users`: array of users, which were not available in the contact table
391 ### POST api/friendica/group_delete
393 Delete the specified group of contacts; API call need to include the correct gid AND name of the group to be deleted.
397 * `gid`: id of the group to be deleted
398 * `name`: name of the group to be deleted
404 * `success`: true if successfully deleted
405 * `gid`: gid of the deleted group
406 * `name`: name of the deleted group
407 * `status`: "deleted" if successfully deleted
408 * `wrong users`: empty array
412 ### GET api/friendica/notifications
414 Return last 50 [Notifications](help/API-Entities#Notification) for the current user, ordered by date with unseen item on top.
420 ### POST api/friendica/notifications/seen
422 Set notification as seen.
426 - `id`: id of the notification to set seen
430 If the note is linked to an item, returns an [Item](help/API-Entities#Item).
432 Otherwise, a success status is returned:
434 * `success` (json) | `<status>success</status>` (xml)
438 ### GET api/friendica/photo
440 Returns a [Photo](help/API-Entities#Photo).
444 * `photo_id`: Resource id of a photo.
445 * `scale`: (optional) scale value of the photo
447 Returns data of a picture with the given resource.
448 If 'scale' isn't provided, returned data include full url to each scale of the photo.
449 If 'scale' is set, returned data include image data base64 encoded.
451 possibile scale value are:
453 * 0: original or max size by server settings
454 * 1: image with or height at <= 640
455 * 2: image with or height at <= 320
456 * 3: thumbnail 160x160
457 * 4: Profile image at 300x300
458 * 5: Profile image at 80x80
459 * 6: Profile image at 48x48
461 An image used as profile image has only scale 4-6, other images only 0-3
470 "created": "date(YYYY-MM-DD HH:MM:SS)",
471 "edited": "date(YYYY-MM-DD HH:MM:SS)",
472 "title": "photo title",
473 "desc": "photo description",
474 "album": "album name",
475 "filename": "original file name",
479 "profile": "1 if is profile photo",
481 "<scale>": "url to image",
485 "datasize": "size in byte",
486 "data": "base64 encoded image data"
495 <created>date(YYYY-MM-DD HH:MM:SS)</created>
496 <edited>date(YYYY-MM-DD HH:MM:SS)</edited>
497 <title>photo title</title>
498 <desc>photo description</desc>
499 <album>album name</album>
500 <filename>original file name</filename>
501 <type>mime type</type>
502 <height>number</height>
503 <width>number</width>
504 <profile>1 if is profile photo</profile>
506 <link type="mime type" scale="scale number" href="image url"/>
512 ### GET api/friendica/photos/list
514 Returns the API user's [Photo List Items](help/API-Entities#Photo+List+Item).
524 "album": "album name",
525 "filename": "original file name",
526 "type": "image mime type",
527 "thumb": "url to thumb sized image"
536 <photos type="array">
537 <photo id="resource_id"
539 filename="original file name"
540 type="image mime type">
541 "url to thumb sized image"
547 ### POST api/friendica/photo/create
549 Alias of [`api/friendica/photo/update`](#POST+api%2Ffriendica%2Fphoto%2Fupdate)
551 ### POST api/friendica/photo/update
553 Saves data for the scales 0-2 to database (see above for scale description).
554 Call adds non-public entries to items table to enable authenticated contacts to comment/like the photo.
555 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.
556 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.
560 * `photo_id` (optional): if specified the photo with this id will be updated
561 * `media` (optional): image data as base64, only optional if photo_id is specified (new upload must have media)
562 * `desc` (optional): description for the photo, updated when photo_id is specified
563 * `album`: name of the album to be deleted (always necessary)
564 * `album_new` (optional): can be used to change the album of a single photo if photo_id is specified
565 * `allow_cid`/`allow_gid`/`deny_cid`/`deny_gid` (optional):
566 - on create: empty string or omitting = public photo, specify in format ```<x><y><z>``` for private photo
567 - on update: keys need to be present with empty values for changing a private photo to public
573 * new photo uploaded: JSON return with photo data (see [GET api/friendica/photo](#GET+api%2Ffriendica%2Fphoto))
574 * photo updated - changed photo data: JSON return with photo data (see [GET api/friendica/photo](#GET+api%2Ffriendica%2Fphoto))
575 * photo updated - changed info: JSON return `{"result": "updated", "message":"Image id 'xyz' has been updated."}`
576 * photo updated - nothing changed: JSON return `{"result": "cancelled","message": "Nothing to update for image id 'xyz'."}`
580 * 403 FORBIDDEN: if not authenticated
581 * 400 BADREQUEST: "no albumname specified", "no media data submitted", "photo not available", "acl data invalid"
582 * 500 INTERNALSERVERERROR: "image size exceeds PHP config settings, file was rejected by server",
583 "image size exceeds Friendica Config setting (uploaded size: x)",
584 "unable to process image data",
585 "image upload failed",
586 "unknown error - uploading photo failed, see Friendica log for more information",
587 "unknown error - update photo entry in database failed",
588 "unknown error - this error on uploading or updating a photo should never happen"
590 ### POST api/friendica/photo/delete
592 Deletes a single image with the specified id, is not reversible -> ensure that client is asking user for being sure to do this
593 Sets item table entries for this photo to deleted = 1.
597 * `photo_id`: id of the photo to be deleted
608 "message": "photo with id 'xyz' has been deleted from server."
614 * 403 FORBIDDEN: if not authenticated
615 * 400 BADREQUEST: "no photo_id specified", "photo not available"
616 * 500 INTERNALSERVERERROR: "unknown error on deleting photo", "problem with deleting items occurred"
620 ### POST api/friendica/photoalbum/delete
622 Deletes all images with the specified album name, is not reversible -> ensure that client is asking user for being sure to do this.
626 * `album`: name of the album to be deleted
637 "message": "album 'xyz' with all containing photos has been deleted."
643 * 403 FORBIDDEN: if not authenticated
644 * 400 BADREQUEST: "no albumname specified", "album not available"
645 * 500 INTERNALSERVERERROR: "problem with deleting item occured", "unknown error - deleting from database failed"
647 ### POST api/friendica/photoalbum/update
649 Changes the album name to album_new for all photos in album.
653 * `album`: name of the album to be updated
654 * `album_new`: new name of the album
665 "message":"album 'abc' with all containing photos has been renamed to 'xyz'."
671 * 403 FORBIDDEN: if not authenticated
672 * 400 BADREQUEST: "no albumname specified", "no new albumname specified", "album not available"
673 * 500 INTERNALSERVERERROR: "unknown error - updating in database failed"
677 ### GET api/friendica/profile/show
679 Returns the [Profile](help/API-Entities#Profile) data of the authenticated user.
683 On success: Array of:
685 * `global_dir`: URL of the global directory set in server settings
686 * `friendica_owner`: user data of the authenticated user
687 * `profiles`: array of the profile data
690 HTTP 403 Forbidden: when no authentication was provided
691 HTTP 400 Bad Request: if given profile_id is not in the database or is not assigned to the authenticated user
693 General description of profile data in API returns:
694 - hide_friends: true if friends are hidden
697 - publish: true if published on the server's local directory
698 - net_publish: true if published to global_dir
710 - custom_fields: list of public custom fields
714 ## Deprecated endpoints
716 - POST api/statuses/mediap