SM - Advanced Api

SM - Advanced Api 1.0.4

Нет прав для скачивания
Совместимость с XenForo
  1. 2.1
  2. 2.2
Аддон создает новый endpoint - "/api/entity/названиесущности" через которую возможно получить все данные сущности и ее связей.

Для доступа требуется XF-Api-Key с правами entity:read.

Используйте данный аддон только в том случае, если вы понимаете зачем он нужен и какую потенциальную опасность несет в себе.

Список всех доступных сущностей:

GET .../api/entity
JSON:
[
    "activitysummarydefinition",
    "activitysummarysection",
    "addon",
    "addoninstallbatch",
    "admin",
    "adminlog",
    "adminnavigation",
    "adminpermission",
    "advertising",
    "advertisingposition",
    "apiattachmentkey",
    "apikey",
    "apilogintoken",
    "apiscope",
    "approvalqueue",
    "attachment",
    "attachmentdata",
    "banemail",
    "bbcode",
    "bbcodemediasite",
    "bookmarkitem",
    "bookmarklabel",
    "bookmarklabeluse",
    "captchalog",
    "captchaquestion",
    "category",
    "changelog",
    "classextension",
    "codeevent",
    "codeeventlistener",
    "connectedaccountprovider",
    "contenttypefield",
    "contentvote",
    "conversationmaster",
    "conversationmessage",
    "conversationrecipient",
    "conversationuser",
    "cronentry",
    "deletionlog",
    "draft",
    "edithistory",
    "editordropdown",
    "emailbouncelog",
    "errorlog",
    "feed",
    "feedlog",
    "filecheck",
    "findnew",
    "findnewdefault",
    "forum",
    "forumfield",
    "forumprefix",
    "forumprompt",
    "forumread",
    "forumwatch",
    "helppage",
    "imageproxy",
    "imageproxyreferrer",
    "ip",
    "ipmatch",
    "language",
    "likedcontent",
    "linkforum",
    "linkproxy",
    "linkproxyreferrer",
    "loginattempt",
    "memberstat",
    "moderator",
    "moderatorcontent",
    "moderatorlog",
    "navigation",
    "newsfeed",
    "node",
    "nodetype",
    "notice",
    "oembed",
    "oembedreferrer",
    "option",
    "optiongroup",
    "optiongrouprelation",
    "page",
    "paymentprofile",
    "paymentprovider",
    "paymentproviderlog",
    "permission",
    "permissioncachecontent",
    "permissioncombination",
    "permissioncombinationusergroup",
    "permissionentry",
    "permissionentrycontent",
    "phrase",
    "phrasemap",
    "poll",
    "pollresponse",
    "pollvote",
    "post",
    "preregaction",
    "profilepost",
    "profilepostcomment",
    "purchasable",
    "purchaserequest",
    "reaction",
    "reactioncontent",
    "report",
    "reportcomment",
    "route",
    "routefilter",
    "search",
    "searchforum",
    "searchforumcache",
    "searchforumusercache",
    "sessionactivity",
    "sitemaplog",
    "smilie",
    "smiliecategory",
    "spamcleanerlog",
    "spamtriggerlog",
    "style",
    "styleproperty",
    "stylepropertygroup",
    "stylepropertymap",
    "tag",
    "tagcontent",
    "tagresultcache",
    "template",
    "templatehistory",
    "templatemap",
    "templatemodification",
    "templatemodificationlog",
    "tfaattempt",
    "tfaprovider",
    "thread",
    "threadfield",
    "threadfieldvalue",
    "threadprefix",
    "threadprefixgroup",
    "threadprompt",
    "threadpromptgroup",
    "threadquestion",
    "threadread",
    "threadredirect",
    "threadreplyban",
    "threaduserpost",
    "threadwatch",
    "trophy",
    "unfurlresult",
    "upgradecheck",
    "user",
    "useralert",
    "useralertoptout",
    "userauth",
    "userban",
    "userchangetemp",
    "userconfirmation",
    "userconnectedaccount",
    "userfield",
    "userfieldvalue",
    "userfollow",
    "usergroup",
    "usergrouppromotion",
    "usergrouppromotionlog",
    "userignored",
    "useroption",
    "userprivacy",
    "userprofile",
    "userpushoptout",
    "userreject",
    "userremember",
    "usertfa",
    "usertfatrusted",
    "usertitleladder",
    "usertrophy",
    "userupgrade",
    "userupgradeactive",
    "userupgradeexpired",
    "usernamechange",
    "warning",
    "warningaction",
    "warningactiontrigger",
    "warningdefinition",
    "widget",
    "widgetdefinition",
    "widgetposition"
]
Для примера рассмотрим сущность thread (XF/Entity/Thread):

Получаем список доступных связей (только TO_ONE) - GET .../api/entity/thread/relations
JSON:
[
[
    "Forum",
    "User",
    "FirstPost",
    "LastPost",
    "LastPoster",
    "Prefix",
    "DeletionLog",
    "ApprovalQueue",
    "Redirect",
    "Poll",
    "Question"
]
]

Получаем список тем вместе с связью Forum - GET .../api/entity/thread?with=Forum
JSON:
[
{
    "meta": {
        "entity": "thread",
        "href": "http://localhost:5480/api/entity/thread",
        "size": 1,
        "limit": 100,
        "offset": 0
    },
    "rows": [
        {
            "thread_id": 1,
            "node_id": 2,
            "title": "123123",
            "reply_count": 1,
            "view_count": 3,
            "user_id": 1,
            "username": "admin",
            "post_date": 1594822204,
            "sticky": false,
            "discussion_state": "visible",
            "discussion_open": true,
            "discussion_type": "discussion",
            "type_data": [],
            "first_post_id": 1,
            "last_post_date": 1594824733,
            "last_post_id": 2,
            "last_post_user_id": 1,
            "last_post_username": "admin",
            "first_post_reaction_score": 0,
            "first_post_reactions": [],
            "prefix_id": 0,
            "custom_fields": {},
            "tags": [],
            "vote_score": 0,
            "vote_count": 0,
            "Forum": {
                "breadcrumbs": [
                    {
                        "node_id": 1,
                        "title": "Main category",
                        "node_type_id": "Category"
                    }
                ],
                "description": "",
                "display_in_list": true,
                "display_order": 1,
                "node_id": 2,
                "node_name": null,
                "node_type_id": "Forum",
                "parent_node_id": 1,
                "title": "Main forum",
                "type_data": {
                    "allow_posting": true,
                    "can_create_thread": false,
                    "can_upload_attachment": false,
                    "discussion": {
                        "allowed_thread_types": [
                            "discussion"
                        ],
                        "allow_answer_voting": true,
                        "allow_answer_downvote": true
                    },
                    "discussion_count": 3,
                    "forum_type_id": "discussion",
                    "is_unread": true,
                    "last_post_date": 1595964119,
                    "last_post_id": 5,
                    "last_post_username": "admin",
                    "last_thread_id": 4,
                    "last_thread_prefix_id": 0,
                    "last_thread_title": "44412312312",
                    "message_count": 4,
                    "min_tags": 0,
                    "require_prefix": false
                },
                "view_url": "http://localhost:5480/index.php?forums/main-forum.2/"
            }
        }
    ]
}
]

Все методы:

Список доступных сущностей - GET .../api/entity
Список связей сущности - GET .../api/entity/thread/relations
Список колонок сущности - GET .../api/entity/thread/columns
Структура сущности - GET .../api/entity/thread/structure

Фильтр - GET .../api/entity/thread?filter=node_id=1;node_id=2
Порядок - GET .../api/entity/thread?orderby=node_id,desc;user_id,asc
Лимит - GET .../api/entity/thread?limit=10&offset=0
Поиск - GET .../api/entity/thread?search=Test

Связь - GET .../api/entity/thread?with=LastPost,User

PHP не ниже 7.1.0

Исходный код:
  • Мне нравится
Реакции: rus-in и Desalin
Автор
smadream
Скачивания
9
Просмотры
676
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок

Другие ресурсы пользователя smadream

Поделиться ресурсом

Последние обновления

  1. 1.0.4

    - Аддон переделан. Смотрите описание.
Назад
Сверху Снизу