# Dosya Yönetimi
## Dosya Yükle
> **POST** `/v3/files`
Tripo platformuna bir dosya yükleyin ve sonraki API aramaları için bir file_token edinin.
### İstek Parametreleri
#### Başlıkları Talep Et
| Parametre | Tür | Gerekli | Varsayılan | Açıklama |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | dize | Evet | — | `multipart/form-data` |
| Authorization | dize | Evet | — | `Bearer {api_key}` |
#### İstek Gövdesi (çok parçalı/form-data)
| Parametre | Tür | Gerekli | Varsayılan | Açıklama |
| :-: | :-: | :-: | :-: | :-: |
| file | ikili | Evet | — | Dosya verileri. Görüntüler JPEG/PNG'yi ve 20'ye kadar MB'yi destekler. Modeller GLB/GLTF/FBX/OBJ/STL'yi, 150'ye kadar MB'yi destekler |
#### Örnek Talep
##### curl
```bash
curl -X POST https://openapi.tripo3d.ai/v3/files \
-H "Authorization: Bearer {api_key}" \
-F "file=@/path/to/model.glb"
```
##### Python
```python
import requests
url = "https://openapi.tripo3d.ai/v3/files"
headers = {
"Authorization": "Bearer {api_key}"
}
files = {
"file": open("/path/to/model.glb", "rb")
}
response = requests.post(url, headers=headers, files=files)
print(response.json())
```
##### JavaScript
```javascript
const url = "https://openapi.tripo3d.ai/v3/files";
const formData = new FormData();
formData.append("file", fileBlob, "model.glb");
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": "Bearer {api_key}"
},
body: formData
});
const data = await response.json();
console.log(data);
```
### Yanıt
#### Başarılı Yanıt
```json
{
"code": 0,
"data": {
"file_token": "file_abc123"
}
}
```
#### Yanıt Alanları
| Parametre | Tür | Açıklama |
| :-: | :-: | :-: |
| code | tamsayı | Durum kodu. `0` başarıyı gösterir |
| data.file_token | dize | Sonraki API çağrıları için kullanılan benzersiz dosya tanımlayıcı |
---
## Yükleme Kimlik Bilgilerini Alın
> **POST** `/v3/files/upload-credentials`
Büyük dosyaları doğrudan istemciden bulut depolama alanına yüklemek için doğrudan yükleme kimlik bilgilerini (STS) alın.
### İstek Parametreleri
#### Başlıkları Talep Et
| Parametre | Tür | Gerekli | Varsayılan | Açıklama |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | dize | Evet | — | `application/json` |
| Authorization | dize | Evet | — | `Bearer {api_key}` |
#### Örnek Talep
##### curl
```bash
curl -X POST https://openapi.tripo3d.ai/v3/files/upload-credentials \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {api_key}"
```
##### Python
```python
import requests
url = "https://openapi.tripo3d.ai/v3/files/upload-credentials"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
}
response = requests.post(url, headers=headers)
print(response.json())
```
##### JavaScript
```javascript
const url = "https://openapi.tripo3d.ai/v3/files/upload-credentials";
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
}
});
const data = await response.json();
console.log(data);
```
### Yanıt
#### Başarılı Yanıt
```json
{
"code": 0,
"data": {
"file_token": "file_abc123",
"upload_url": "https://storage.example.com/upload/...",
"expires_at": "2025-01-01T01:00:00Z"
}
}
```
#### Yanıt Alanları
| Parametre | Tür | Açıklama |
| :-: | :-: | :-: |
| code | tamsayı | Durum kodu. `0` başarıyı gösterir |
| data.file_token | dize | Benzersiz dosya tanımlayıcı |
| data.upload_url | dize | Önceden imzalanmış yükleme URL. İstemci dosyayı doğrudan PUT ile yükler |
| data.expires_at | dize | Kimlik bilgilerinin geçerlilik süresi (ISO 8601) |
Dosya Yönetimi
Dosya Yükle
POST /v3/files
Tripo platformuna bir dosya yükleyin ve sonraki API aramaları için bir file_token edinin.
İstek Parametreleri
Başlıkları Talep Et
| Parametre |
Tür |
Gerekli |
Varsayılan |
Açıklama |
| Content-Type |
dize |
Evet |
— |
multipart/form-data |
| Authorization |
dize |
Evet |
— |
Bearer {api_key} |
İstek Gövdesi (çok parçalı/form-data)
| Parametre |
Tür |
Gerekli |
Varsayılan |
Açıklama |
| file |
ikili |
Evet |
— |
Dosya verileri. Görüntüler JPEG/PNG’yi ve 20’ye kadar MB’yi destekler. Modeller GLB/GLTF/FBX/OBJ/STL’yi, 150’ye kadar MB’yi destekler |
Örnek Talep
curl -X POST https://openapi.tripo3d.ai/v3/files \
-H "Authorization: Bearer {api_key}" \
-F "file=@/path/to/model.glb"
import requests
url = "https://openapi.tripo3d.ai/v3/files"
headers = {
"Authorization": "Bearer {api_key}"
}
files = {
"file": open("/path/to/model.glb", "rb")
}
response = requests.post(url, headers=headers, files=files)
print(response.json())
const url = "https://openapi.tripo3d.ai/v3/files";
const formData = new FormData();
formData.append("file", fileBlob, "model.glb");
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": "Bearer {api_key}"
},
body: formData
});
const data = await response.json();
console.log(data);
Yanıt
Başarılı Yanıt
{
"code": 0,
"data": {
"file_token": "file_abc123"
}
}
Yanıt Alanları
| Parametre |
Tür |
Açıklama |
| code |
tamsayı |
Durum kodu. 0 başarıyı gösterir |
| data.file_token |
dize |
Sonraki API çağrıları için kullanılan benzersiz dosya tanımlayıcı |
Yükleme Kimlik Bilgilerini Alın
POST /v3/files/upload-credentials
Büyük dosyaları doğrudan istemciden bulut depolama alanına yüklemek için doğrudan yükleme kimlik bilgilerini (STS) alın.
İstek Parametreleri
Başlıkları Talep Et
| Parametre |
Tür |
Gerekli |
Varsayılan |
Açıklama |
| Content-Type |
dize |
Evet |
— |
application/json |
| Authorization |
dize |
Evet |
— |
Bearer {api_key} |
Örnek Talep
curl -X POST https://openapi.tripo3d.ai/v3/files/upload-credentials \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {api_key}"
import requests
url = "https://openapi.tripo3d.ai/v3/files/upload-credentials"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
}
response = requests.post(url, headers=headers)
print(response.json())
const url = "https://openapi.tripo3d.ai/v3/files/upload-credentials";
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
}
});
const data = await response.json();
console.log(data);
Yanıt
Başarılı Yanıt
{
"code": 0,
"data": {
"file_token": "file_abc123",
"upload_url": "https://storage.example.com/upload/...",
"expires_at": "2025-01-01T01:00:00Z"
}
}
Yanıt Alanları
| Parametre |
Tür |
Açıklama |
| code |
tamsayı |
Durum kodu. 0 başarıyı gösterir |
| data.file_token |
dize |
Benzersiz dosya tanımlayıcı |
| data.upload_url |
dize |
Önceden imzalanmış yükleme URL. İstemci dosyayı doğrudan PUT ile yükler |
| data.expires_at |
dize |
Kimlik bilgilerinin geçerlilik süresi (ISO 8601) |