123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Simple API Request</title>
- <script>
- function makeApiRequest() {
- const apiUrl = 'https://canvas-api-test.anvil.app/_/api/creation-module/3d-image/00bb64d51647486392fabc361ec69b7d';
- fetch(apiUrl)
- .then(response => response.json())
- .then(data => {
- document.getElementById('responseBox').value = JSON.stringify(data, null, 2);
- })
- .catch(error => {
- document.getElementById('responseBox').value = 'Error: ' + error;
- });
- }
- function makePostRequest() {
- const apiUrl = 'https://canvas-api-test.anvil.app/_/api/creation-module/3d-image/submit';
- const postData = {
- "scene": {
- "objects": [
- {
- "name": "LNG Serum",
- "type": "group",
- "group_type": "product",
- "id": "15a314a1-8ba1-4e0e-ad0c-f605b06f89f8",
- "properties": {
- "transform": {
- "position": [0, 0, 0],
- "rotation": [-8, -6.9, -42],
- "scale": [1, 1, 1]
- },
- "visible": true
- }
- },
- {
- "name": "Sphere",
- "type": "group",
- "group_type": "shape",
- "id": "15a314a1-8ba1-4e0e-ad0c-f605b06f89h3",
- "properties": {
- "transform": {
- "position": [-0.041122, -0.036135, 0.155559],
- "rotation": [0, 0, 0],
- "scale": [0.74098, 0.74098, 0.74098]
- },
- "visible": true,
- "color": { "r": 0.5, "g": 0.5, "b": 0.5 }
- }
- },
- {
- "name": "Sphere",
- "type": "group",
- "group_type": "shape",
- "id": "15a314a1-8ba1-4e0e-ad0c-f605b06f89h3",
- "properties": {
- "transform": {
- "position": [0.067047, 0.088912, -0.023188],
- "rotation": [0, 0, 0],
- "scale": [0.4103, 0.4103, 0.4103]
- },
- "visible": true,
- "color": { "r": 0.5, "g": 0.5, "b": 0.5 }
- }
- },
- {
- "name": "Sphere",
- "type": "group",
- "group_type": "shape",
- "id": "15a314a1-8ba1-4e0e-ad0c-f605b06f89h3",
- "properties": {
- "transform": {
- "position": [-0.041122, -0.132029, 0.078844],
- "rotation": [0, 0, 0],
- "scale": [0.16679, 0.16679, 0.16679]
- },
- "visible": true,
- "color": { "r": 0.5, "g": 0.5, "b": 0.5 }
- }
- }
- ],
- "cameras": [
- {
- "name": "Camera",
- "type": "camera",
- "properties": {
- "transform": {
- "position": [0.432918, -0.202823, 0.08365],
- "rotation": [88.8032, 0.786282, 66.6831]
- },
- "lens": {
- "type": "perspective",
- "fov": 46.8,
- "near": 0.1,
- "far": 100
- },
- "active": true
- }
- }
- ],
- "environment": {
- "background": {
- "type": "color",
- "color": { "r": 1, "g": 1, "b": 1 }
- },
- "lighting": {
- "type": "image",
- "id": "15a314a1-8ba1-4e0e-ad0c-f605b06f89e9",
- "intensity": 1,
- "rotation": 0,
- "flip_horizontal": false,
- "flip_vertical": false,
- "visible": false
- }
- }
- },
- "user_id": "1125441",
- "project_id": "15a314a1-8ba1-4e0e-ad0c-f605b06f89f8"
- };
- fetch(apiUrl, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(postData)
- })
- .then(response => response.json())
- .then(data => {
- document.getElementById('responseBox').value = JSON.stringify(data, null, 2);
- })
- .catch(error => {
- document.getElementById('responseBox').value = 'Error: ' + error;
- });
- }
- </script>
- </head>
- <body>
- <h1>Simple API Request</h1>
- <button onclick="makeApiRequest()">Get Data</button>
- <button onclick="makePostRequest()">Submit Data</button>
- <br><br>
- <textarea id="responseBox" rows="10" cols="50" placeholder="Response will be displayed here..."></textarea>
- </body>
- </html>
|