microsoft-foundry.rest.security.o-auth2-auth
Containers
Get a container file
GET
/openai/v1/containers/{container_id}/files/{file_id}
Retrieves a container file by its identifier.
Parâmetros de caminho
container_id
string
exigido
The ID of the container.
file_id
string
exigido
The ID of the file.
Respostas
The request has succeeded.
Corpo
Content-Type: application/json
id
string
exigido
Unique identifier for the file.
object
enum
exigido
The type of this object (container.file).
container.file
container_id
string
exigido
The container this file belongs to.
created_at
integer
exigido
Unix timestamp (in seconds) when the file was created.
bytes
integer
exigido
path
string
exigido
Path of the file in the container.
source
string
exigido
Source of the file (e.g., user, assistant).
Solicitar
curl https://api.openai.com/v1/containers/container_123/files/file_456 \
-H "Authorization: Bearer $OPENAI_API_KEY"
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const file = await client.containers.files.retrieve('file_id', { container_id: 'container_id' });
console.log(file.id);
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
file = client.containers.files.retrieve(
file_id="file_id",
container_id="container_id",
)
print(file.id)
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
file, err := client.Containers.Files.Get(
context.TODO(),
"container_id",
"file_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v
", file.ID)
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.files.FileRetrieveParams;
import com.openai.models.containers.files.FileRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileRetrieveParams params = FileRetrieveParams.builder()
.containerId("container_id")
.fileId("file_id")
.build();
FileRetrieveResponse file = client.containers().files().retrieve(params);
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
file = openai.containers.files.retrieve("file_id", container_id: "container_id")
puts(file)
Resposta
{
"id": "cfile_682e0e8a43c88191a7978f477a09bdf5",
"object": "container.file",
"created_at": 1747848842,
"bytes": 880,
"container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04",
"path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json",
"source": "user"
}