API WA theme theme cover theme еlement
Описание существующего wa admin API при работе с темами.
1. Upload image Theme Element file.
POST http://localhost/api/theme/<theme_id>/up-element/
theme_id - ID темы
file multipart/form-data - image file
type - Возможные значения “cover” | “bg”
Если cover_type == ‘cover’ обязательное поле cover_type
cover_type - Возможные значения “FRONT_COVER_BACKGROUND” | “SPINE_BACKGROUND” | “BACK_COVER_BACKGROUND”
2. Delete Theme Element.
DELETE http://localhost/api/theme/<theme_id>/element/<element_id>/
theme_id - ID темы
element_id - Element ID
3. Получить список theme_element для темы theme_id и возможного типа (element_type) елемента темы theme_element
GET http://localhost/api/theme/<theme_id>/element/?element_type=FRONT_COVER_BACKGROUND
GET http://localhost/api/theme/<theme_id>/element/?element_type=PAGE_BACKGROUND
Response example:
element_type = FRONT_COVER_BACKGROUND
[
{
"id": 15460,
"image_type": "",
"position": "UNIVERSAL",
"theme": 379,
"element_type": "FRONT_COVER_BACKGROUND",
"is_pattern": false,
"format": "UNIVERSAL",
"scale": 100,
"image": "/media/te/15/46/15460",
"width": 5616,
"height": 3744
}
]
Возможные варианты element_type (заложены в систему :-):
ELEMENT_TYPES = (
(FRONT_COVER_BACKGROUND, _('Фон передней обложки')),
(BACK_COVER_BACKGROUND, _('Фон задней обложки')),
(COVER_BACKGROUND, _('Фон обложки')),
(SPINE_BACKGROUND, _('Фон корешка')),
(PAGE_BACKGROUND, _('Фон страницы')),
(FORMAT_STRIPE, _('Форматная полоса')),
(CORNER, _('Уголок')),
(DESIGN_ELEMENT, _('Элемент оформления')),
)
DB structure. Integrate theme_cover in existing system
Диаграмма БД для группировки елементов схемы theme_elements в сущность theme_cover
https://drive.google.com/file/d/1gnPv4-3Z6c2_T78lweL1th9XFpCc3qnM/view?usp=sharing
Запрос на установку схемы на страницу
{
"transaction_id":"f5d638e6-ac6f-c990-31ef-b7c5e11715b1",
"object":"page",
"action":"set",
"params":{
"layout_id":"118bed53-6f62-4101-bc72-dae6187b2745",
"id":"551dd345-e8eb-4244-a831-66943d727d5f"
},
"payload":{
"id":11300
}
}
params:
- layout_id":“118bed53-6f62-4101-bc72-dae6187b2745”,
- id “551dd345-e8eb-4244-a831-66943d727d5f”
payload:
- id":11300
Вопросы:
Какой API запрос нужен сделать,
чтоб достать информацию об обложке
theme~~theme_cover~~>theme_elements
Что делать если это theme_element принадлежит theme_cover
Описание работы на FRONT:
[[FRONT работа с фонами (темами)]]