On the fly Product Rendering via API (2) (2)
The new way of visualizer integration allows on-the-fly import & visualization of the rendered product - i.e. you can visualize products from your catalogue without importing these products to Wizart PIM first.
Please remember that the type of custom products currently available for rendering on-the-fly are Wall Murals. Other product types can be added upon request.
Step 1. Upload custom interior and get uuid of this interior
Use next endpoint to upload custom interior: https://rni.wizart.ai/api/rooms
.
Example of the request (cURL):
curl --location --request POST 'https://rni.wizart.tech/api/rooms' \
--header 'Accept: application/json' \
--header 'Device-Token: {{ DEVICE_TOKEN }}' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: {{ API_KEY }}' \
--form 'image=@"{{ PATH_TO_IMAGE }}"'
where:
{{ API_KEY }} - authorization token provided by WIZART;
{{ PATH_TO_IMAGE }} - path to the interior image;
{{ DEVICE_TOKEN }} - device ID (any generated unique key).
Example of the response:
{
"uuid":"a918c4d5-7704-4c67-a01b-00c208db6d15",
"title":"Test Mural",
"image_path":"interiors\/uploaded\/images\/97a1dd1a-0b93-44db-b03b-e9d05f510739.png",
"room_type_title":"MyInteriors",
"room_type_id":1,
"width":982,
"height":515,
"surfaces":null,
"created_at":"31.10.2022",
"scene_image_info":{"bad_target_confidence":1,"blurry_confidence":0.6826421022415161,"dark_confidence":1,"noisy_confidence":0.007772059179842472},
"ceiling":null,
"floor":null,
"walls":[{"x":49.94908350305499,"y":49.90291262135922,"wall_id":0}]
}
To render custom products you need know UUID of the room (second line).
Step 2. Apply product from your catalogue in the interior
Example of request:
curl --location --request POST 'https://rni.wizart.ai/apply/custom?hash={{ HASH }}' \
--header 'device-token: {{ DEVICE_TOKEN }}' \
--header 'authorization: {{ API_KEY }}' \
--header 'Content-Type: application/json' \
--data-raw '{"data":{"type":"products","attributes":{"type":"wall_mural","name":"Murals 02","vendor_code":"Murals 02","image_path":"{{ PATH_TO_IMAGE }}","preview_path":"","link":"","width":"3","height":"5","unit":"m","repeatable":1,"surface":["wall"],"height_feet":0,"height_inch":0,"width_feet":0,"width_inch":0},"relationships":{"selected_surfaces":{"data":[{"type":"walls","id":0}]},"rooms":{"data":{"type":"rooms","id":"{{ ROOM_UUID }}"}},"share":null}},"included":[]}'
where:
{{ HASH }} - you need to generate this hash by MD5 hash of HTTP request body;
{{ DEVICE_TOKEN }} - device ID (any generated unique key);
{{ API_KEY }} - authorization token provided by WIZART;
{{ PATH_TO_IMAGE }} - path to the interior image;
{{ ROOM_UUID }} - UUID that you retrieved from Step 1.
Â