java/resources/uploads/methods/cancel/index.md +0 −174 deleted
File Deleted View Diff
1## Cancel upload
2
3`Upload uploads().cancel(UploadCancelParamsparams = UploadCancelParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
4
5**post** `/uploads/{upload_id}/cancel`
6
7Cancels the Upload. No Parts may be added after an Upload is cancelled.
8
9Returns the Upload object with status `cancelled`.
10
11### Parameters
12
13- `UploadCancelParams params`
14
15 - `Optional<String> uploadId`
16
17### Returns
18
19- `class Upload:`
20
21 The Upload object can accept byte chunks in the form of Parts.
22
23 - `String id`
24
25 The Upload unique identifier, which can be referenced in API endpoints.
26
27 - `long bytes`
28
29 The intended number of bytes to be uploaded.
30
31 - `long createdAt`
32
33 The Unix timestamp (in seconds) for when the Upload was created.
34
35 - `long expiresAt`
36
37 The Unix timestamp (in seconds) for when the Upload will expire.
38
39 - `String filename`
40
41 The name of the file to be uploaded.
42
43 - `JsonValue; object_ "upload"constant`
44
45 The object type, which is always "upload".
46
47 - `UPLOAD("upload")`
48
49 - `String purpose`
50
51 The intended purpose of the file. [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose) for acceptable values.
52
53 - `Status status`
54
55 The status of the Upload.
56
57 - `PENDING("pending")`
58
59 - `COMPLETED("completed")`
60
61 - `CANCELLED("cancelled")`
62
63 - `EXPIRED("expired")`
64
65 - `Optional<FileObject> file`
66
67 The `File` object represents a document that has been uploaded to OpenAI.
68
69 - `String id`
70
71 The file identifier, which can be referenced in the API endpoints.
72
73 - `long bytes`
74
75 The size of the file, in bytes.
76
77 - `long createdAt`
78
79 The Unix timestamp (in seconds) for when the file was created.
80
81 - `String filename`
82
83 The name of the file.
84
85 - `JsonValue; object_ "file"constant`
86
87 The object type, which is always `file`.
88
89 - `FILE("file")`
90
91 - `Purpose purpose`
92
93 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
94
95 - `ASSISTANTS("assistants")`
96
97 - `ASSISTANTS_OUTPUT("assistants_output")`
98
99 - `BATCH("batch")`
100
101 - `BATCH_OUTPUT("batch_output")`
102
103 - `FINE_TUNE("fine-tune")`
104
105 - `FINE_TUNE_RESULTS("fine-tune-results")`
106
107 - `VISION("vision")`
108
109 - `USER_DATA("user_data")`
110
111 - `Status status`
112
113 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
114
115 - `UPLOADED("uploaded")`
116
117 - `PROCESSED("processed")`
118
119 - `ERROR("error")`
120
121 - `Optional<Long> expiresAt`
122
123 The Unix timestamp (in seconds) for when the file will expire.
124
125 - `Optional<String> statusDetails`
126
127 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
128
129### Example
130
131```java
132package com.openai.example;
133
134import com.openai.client.OpenAIClient;
135import com.openai.client.okhttp.OpenAIOkHttpClient;
136import com.openai.models.uploads.Upload;
137import com.openai.models.uploads.UploadCancelParams;
138
139public final class Main {
140 private Main() {}
141
142 public static void main(String[] args) {
143 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
144
145 Upload upload = client.uploads().cancel("upload_abc123");
146 }
147}
148```
149
150#### Response
151
152```json
153{
154 "id": "id",
155 "bytes": 0,
156 "created_at": 0,
157 "expires_at": 0,
158 "filename": "filename",
159 "object": "upload",
160 "purpose": "purpose",
161 "status": "pending",
162 "file": {
163 "id": "id",
164 "bytes": 0,
165 "created_at": 0,
166 "filename": "filename",
167 "object": "file",
168 "purpose": "assistants",
169 "status": "uploaded",
170 "expires_at": 0,
171 "status_details": "status_details"
172 }
173}
174```