Managing files and assets in ProductFlo
// Using FormData const formData = new FormData(); formData.append('file', fileObject); formData.append('product_id', 'product-123'); const response = await fetch('https://api.productflo.io/files/upload', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_TOKEN', 'X-Tenant-ID': 'tenant-123' }, body: formData }); const data = await response.json();
// Direct download (browser will handle the file) window.location.href = `https://api.productflo.io/files/${fileId}/download?token=${accessToken}`;
{ "id": "file-123", "name": "assembly-v2.step", "size": 2456789, "type": "model/step", "mime_type": "application/step", "created_at": "2023-05-01T12:34:56.789Z", "updated_at": "2023-05-15T09:22:33.456Z", "created_by": "user-456", "current_revision_id": "rev-789", "revision_count": 3, "path": "/designs/2023/assembly-v2.step", "url": "https://api.productflo.io/files/file-123/download", "preview_url": "https://api.productflo.io/files/file-123/preview", "thumbnail_url": "https://api.productflo.io/files/file-123/thumbnail", "product_id": "product-789", "description": "Final assembly design for the prototype", "tags": ["assembly", "prototype", "final"], "metadata": { "dimensions": { "width": 120.5, "height": 85.3, "depth": 45.2, "units": "mm" }, "components": 37, "software": "Fusion 360 v2023.1", "custom_properties": { "material": "Aluminum 6061", "finish": "Anodized", "color": "Black" } }, "permissions": { "view": ["team-123", "user-456", "user-789"], "edit": ["team-123"], "delete": ["user-456"] } }
{ "id": "annotation-123", "file_id": "file-456", "user_id": "user-789", "created_at": "2023-06-01T10:20:30.456Z", "text": "We need to reinforce this connection point", "position": { "x": 120.5, "y": 85.3, "z": 45.2 }, "target": { "type": "point", // or "area", "component" "component_id": "component-123" // if targeting a specific component }, "color": "#FF5733", "status": "open", // or "resolved", "in-progress" "replies": [ { "id": "reply-123", "user_id": "user-456", "created_at": "2023-06-01T11:22:33.789Z", "text": "I'll add a gusset plate here" } ] }