-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbasicProjectCreationFlow.json
More file actions
427 lines (427 loc) · 21.3 KB
/
basicProjectCreationFlow.json
File metadata and controls
427 lines (427 loc) · 21.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
{
"info": {
"_postman_id": "834110cf-88be-4176-b413-b4df8a4b8b29",
"name": "Basic project creation flow",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Authenticate",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);\r",
"pm.collectionVariables.set(\"lc_access_token\", jsonData.access_token);"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "client_id",
"value": "",
"type": "text"
},
{
"key": "client_secret",
"value": "",
"type": "text"
},
{
"key": "grant_type",
"value": "client_credentials",
"type": "text"
},
{
"key": "audience",
"value": "https://api.sdl.com",
"type": "text"
}
]
},
"url": {
"raw": "https://sdl-prod.eu.auth0.com/oauth/token",
"protocol": "https",
"host": [
"sdl-prod",
"eu",
"auth0",
"com"
],
"path": [
"oauth",
"token"
]
},
"description": "<h1>Authentication</h1>\n\n \nPlease read carefully about [Authentication](https://languagecloud.sdl.com/lc/api-docs/authenticate), and take into consideration that some steps might be done by RWS engineering."
},
"response": []
},
{
"name": "Create Project",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var projectResponse = JSON.parse(responseBody);\r",
"pm.globals.set(\"projectId\", projectResponse.id);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"name\": \"Basic Flow Project Two Files\",\n\t\"description\": \"Basic Flow Project Creation\",\n\t\"dueBy\": \"2022-09-04T08:14:05.858Z\",\n\t\"projectTemplate\": {\n\t\t\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\"\n\t},\n\t\"languageDirections\": [\n\t\t{\n\t\t\t\"sourceLanguage\": {\n\t\t\t\t\"languageCode\": \"en-US\"\n\t\t\t},\n\t\t\t\"targetLanguage\": {\n\t\t\t\t\"languageCode\": \"fr-FR\"\n\t\t\t}\n\t\t}\n\t]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/projects",
"host": [
"{{baseUrl}}"
],
"path": [
"projects"
]
},
"description": "# **Create a new project**\n\nEndpoint: [`POST /projects`](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/createproject)\n\nFor running this endpoint you need to supply the required project details (body tab in Postman):\n\n> `POST` [https://lc-api.sdl.com/public-api/v1/projects](https://lc-api.sdl.com/public-api/v1/projects)\n\n``` json\n{\n \"name\": \"Name of the Project\",\n \"description\": \"Test Project\",\n \"dueBy\": \"2021-09-04T08:14:05.858Z\",\n \"projectTemplate\": {\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\" // Provided by RWS\n },\n \"languageDirections\": [\n {\n \"sourceLanguage\": {\n \"languageCode\": \"en-US\"\n },\n \"targetLanguage\": {\n \"languageCode\": \"fr-FR\"\n }\n }\n ]\n}\n\n```\n\nSource and Target Language Codes can be obtained from [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/language/listlanguages/).\n\nThe API should respond with:\n\n* HTTP Status Code: 201 Created.\n* Body – your project details consisting of `projectId`, `project name`, `language direction`, `location` and other optional fields.\n \n\nExample:\n\n``` json\n{\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\", // The project Id.\n \"name\": \"Name of the Project\",\n \"languageDirections\": [\n {\n \"sourceLanguage\": {\n \"languageCode\": \"en-US\",\n \"englishName\": \"English (United States)\"\n },\n \"targetLanguage\": {\n \"languageCode\": \"fr-FR\",\n \"englishName\": \"French (France)\"\n }\n }\n ],\n \"location\": {\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\",\n \"name\": \"Project Location\"\n }\n}\n\n```\n\n#### Scenario:\n\nIf your company has multiple divisions, you can imagine a hierarchy like this:\n\n**YOUR COMPANY**\n\n* **Marketing Division**\n* **Management Division**\n* **HR Division**\n \n\nIf you want to create projects for different divisions, this can be done by using the `location` parameter, which will be added in the body:\n\n``` json\n{\n \"name\": \"Name of the Project\",\n \"description\": \"Test Project\",\n \"dueBy\": \"2021-09-04T08:14:05.858Z\",\n \"projectTemplate\": {\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\" // Provided by RWS\n },\n \"languageDirections\": [\n {\n \"sourceLanguage\": {\n \"languageCode\": \"en-US\"\n },\n \"targetLanguage\": {\n \"languageCode\": \"fr-FR\"\n }\n }\n ],\n \"location\": \"xxxxxxxxxxxxxxxxxxxxxxxx\" // Provided by RWS\n}\n\n```\n\nUsing this request your project will be created in the specified Division and it will be visible only there.\n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/createproject)."
},
"response": []
},
{
"name": "Add Source File",
"request": {
"method": "POST",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
},
{
"key": "Content-Type",
"value": "multipart/form-data"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "file",
"description": "(Required) ",
"type": "file",
"src": []
},
{
"key": "properties",
"value": "{\n\t\"language\": \"en-US\",\n\t\"type\": \"native\",\n\t\"role\": \"translatable\",\n\t\"name\": \"FileName.Extension\"\n}",
"description": "(Required) ",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/projects/{{projectId}}/source-files",
"host": [
"{{baseUrl}}"
],
"path": [
"projects",
"{{projectId}}",
"source-files"
]
},
"description": "Adds one or more source files to the project by making a request for each file.\n\nEndpoint: [`POST /projects/{projectId}/source-files`](https://languagecloud.sdl.com/lc/api-docs/rest-api/source-file/addsourcefile)\n\nFor running this endpoint you need to:\n\n* Replace `{projectId}` from the URL with the Id received from the Create Project endpoint response:\n \n> `POST` [https://lc-api.sdl.com/public-api/v1/projects/{projectId}/source-files](https://lc-api.sdl.com/public-api/v1/projects/{projectId}/source-files)\n \n* Add the file to the request body.\n* Complete the details from Body tab - Properties field.\n \n ``` json\n {\n \"language\": \"en-US\",\n \"type\": \"native\",\n \"role\": \"translatable\",\n \"name\": \"nameOfTheFile.extension\"\n }\n \n ```\n \n\nResponses:\n\n* HTTP Code 201 Created.\n* Body – a list with Id, name and role of the file.\n \n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/source-file/addsourcefile)."
},
"response": []
},
{
"name": "Start Project",
"request": {
"method": "PUT",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
}
],
"url": {
"raw": "{{baseUrl}}/projects/{{projectId}}/start",
"host": [
"{{baseUrl}}"
],
"path": [
"projects",
"{{projectId}}",
"start"
]
},
"description": "Starts a project.\n\nBefore starting a project, translatable files should be uploaded. If the action is executed on an already started project, new translatable files should be uploaded first.\n\nEndpoint: [`PUT /projects/{projectId}/start`](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/startproject)\n\nFor running this endpoint you need to:\n\n* `PUT` [https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/start](https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/start)\n \n\nResponses:\n\n* HTTP Code 202 Accepted\n \n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/startproject)."
},
"response": []
},
{
"name": "Get Project",
"request": {
"method": "GET",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
}
],
"url": {
"raw": "{{baseUrl}}/projects/{{projectId}}?fields=name, description, dueBy, status, location, languageDirections",
"host": [
"{{baseUrl}}"
],
"path": [
"projects",
"{{projectId}}"
],
"query": [
{
"key": "fields",
"value": "name, description, dueBy, status, location, languageDirections"
}
]
},
"description": "Retrieves a list of all the projects in the account.\n\nEndpoint: [GET /projects/{projectId}](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/getproject)\n\nFor running this endpoint make a request to:\n\n> `GET` [https://lc-api.sdl.com/public-api/v1/projects/{projectId}](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/getproject)\n\nResponses:\n\n* HTTP Code 200 OK.\n* Body – a project with details consisting of projectId, project name, language direction, location and other optional fields\n \n\nExample:\n\n``` json\n{\n\t\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\",\n\t\"name\": \"Translation Project 1\",\n\t\"languageDirections\": [\n\t\t{\n\t\t\t\"sourceLanguage\": {\n\t\t\t\t\"languageCode\": \"en-US\",\n\t\t\t\t\"englishName\": \"English (United States)\"\n\t\t\t},\n\t\t\t\"targetLanguage\": {\n\t\t\t\t\"languageCode\": \"fr-FR\",\n\t\t\t\t\"englishName\": \"French (France)\"\n\t\t\t}\n\t\t}\n\t],\n\t\"location\": {\n\t\t\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\",\n\t\t\"name\": \"Project Location\"\n\t}\n}\n\n```\n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/getproject)."
},
"response": []
},
{
"name": "List Project's Tasks",
"request": {
"method": "GET",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
}
],
"url": {
"raw": "{{baseUrl}}/projects/{{projectId}}/tasks?fields=status, taskType",
"host": [
"{{baseUrl}}"
],
"path": [
"projects",
"{{projectId}}",
"tasks"
],
"query": [
{
"key": "fields",
"value": "status, taskType"
}
]
},
"description": "List the tasks of a specific project. If all the tasks have the status `completed`, all the files are translated.\n\nEndpoint: [`GET /projects/{projectId}/tasks`](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/listprojecttasks/)\n\nFor running this endpoint you need to:\n\n* `GET` [https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/tasks?fields=taskType,status](https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/tasks?fields=taskType,status)\n \n\nUse `?fields=taskType` if you want to observe the task name.\n\nResponses:\n\n* HTTP Code 200 Ok.\n* Body – a list with task Id and Status.\n \n\nExample:\n\n``` json\n{\n \"items\": [\n {\n \"id\": \"613f621fe5ed2804ba31870e\",\n \"status\": \"completed\",\n \"taskType\": {\n \"id\": \"607932f25c7cc701241f0f60\",\n \"key\": \"scan\",\n \"name\": \"File Type Detection\"\n }\n },\n {\n \"id\": \"613f623040d9943308ef7c3b\",\n \"status\": \"completed\",\n \"taskType\": {\n \"id\": \"607932f3ce8af15851b70205\",\n \"key\": \"convert\",\n \"name\": \"File Format Conversion\"\n }\n },\n ...\n ],\n \"itemCount\": 11\n}\n\n```\n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/listprojecttasks/)."
},
"response": []
},
{
"name": "List Target Files",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var listTargetFilesResponse = JSON.parse(responseBody);\r",
"pm.globals.set(\"targetFileId\", listTargetFilesResponse.items[0].id);\r",
"pm.globals.set(\"targetFileVersion\", listTargetFilesResponse.items[0].latestVersion.id);\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
}
],
"url": {
"raw": "{{baseUrl}}/projects/{{projectId}}/target-files?fields=latestVersion,sourceFile.name",
"host": [
"{{baseUrl}}"
],
"path": [
"projects",
"{{projectId}}",
"target-files"
],
"query": [
{
"key": "fields",
"value": "latestVersion,sourceFile.name"
}
]
},
"description": "Retrieves the target `fileId` for a project and the latest version for the translated file.\n\nThe status of the file is available on the \\`status\\` attribute.\n\nEndpoint: [`GET /projects/{projectId}/target-files`](https://languagecloud.sdl.com/lc/api-docs/rest-api/target-file/listtargetfiles)\n\nFor running this endpoint you need to:\n\n* `GET` [https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/target-files?fields=latestVersion,status](https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/target-files?fields=latestVersion,status)\n \n\nResponses:\n\n* HTTP Code 200 Ok.\n* Body – a list with source and target file ids, source and target languages.\n \n\nExample:\n\n``` json\n{\n \"items\": [\n {\n \"id\": \"613f623ae5ed2804ba318a40\", // This is the target file id.\n \"latestVersion\": {\n \"id\": \"613f628540d9943308ef8497\", // This is the file version id.\n \"type\": \"native\",\n \"status\": \"inProgress\"\n }\n },\n {\n \"id\": \"613f623ae5ed2804ba318a43\",\n \"latestVersion\": {\n \"id\": \"613f628a40d9943308ef84cd\",\n \"type\": \"native\",\n \"status\": \"finished\"\n }\n }\n ],\n \"itemCount\": 2\n}\n\n```\n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/target-file/listtargetfiles)."
},
"response": []
},
{
"name": "Download First Target File Version",
"request": {
"method": "GET",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
}
],
"url": {
"raw": "{{baseUrl}}/projects/{{projectId}}/target-files/{{targetFileId}}/versions/{{targetFileVersion}}/download",
"host": [
"{{baseUrl}}"
],
"path": [
"projects",
"{{projectId}}",
"target-files",
"{{targetFileId}}",
"versions",
"{{targetFileVersion}}",
"download"
]
},
"description": "Downloads the translated file.\n\nEndpoint: [`GET /projects/{projectId}/target-files/{targetFileId}/versions/{fileVersionId}/download`](https://languagecloud.sdl.com/lc/api-docs/rest-api/target-file/downloadfileversion)\n\nFor running this endpoint you need to:\n\n* Replace `{projectId}` from the URL with the Id received from the Create Project endpoint response\n* Replace `{targetFileId}` from the URL with the Id received from the List Project Target Files endpoint response\n* Replace `{fileVersionId}` from the URL with the Id received from the List Project Target Files endpoint response\n \n\n> `GET` [https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/target-files/**{targetFileId}**/versions/**{fileVersionId}**/download](https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/target-files/**{targetFileId}**/versions/**{fileVersionId}**/download)\n\nResponses:\n\n* HTTP Code 200 OK.\n* Body – the translated file. The file can be also saved from Save Response option.\n \n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/target-file/downloadfileversion/)."
},
"response": []
},
{
"name": "Complete Project",
"request": {
"method": "PUT",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
}
],
"url": {
"raw": "{{baseUrl}}/projects/{{projectId}}/complete",
"host": [
"{{baseUrl}}"
],
"path": [
"projects",
"{{projectId}}",
"complete"
]
},
"description": "Marks a project as `completed`.\n\nEndpoint: [`PUT /projects/{projectId}/complete`](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/completeproject)\n\nFor running this endpoint you need to:\n\n* `PUT` [https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/complete](https://lc-api.sdl.com/public-api/v1/projects/**{projectId}**/complete)\n \n\nResponses:\n\n* HTTP Code 204 No Content.\n \n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/completeproject)."
},
"response": []
},
{
"name": "List Projects",
"request": {
"method": "GET",
"header": [
{
"description": "(Required) The id of the account where the request is executed.",
"key": "X-LC-Tenant",
"value": "{{lc_tenant}}"
}
],
"url": {
"raw": "{{baseUrl}}/projects",
"host": [
"{{baseUrl}}"
],
"path": [
"projects"
]
},
"description": "Retrieves a list of all the projects in the account.\n\nEndpoint: [`GET /projects`](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/listprojects)\n\nFor running this endpoint make a request to:\n\n> `GET` [https://lc-api.sdl.com/public-api/v1/projects](https://lc-api.sdl.com/public-api/v1/projects)\n\nResponses:\n\n* HTTP Code 200 OK.\n* Body – a list of projects with details consisting of projectId, project name, language direction, location and other optional fields\n \n\nExample:\n\n``` json\n{\n \"items\": [\n {\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\",\n \"name\": \"Translation Project 1\",\n \"languageDirections\": [\n {\n \"sourceLanguage\": {\n \"languageCode\": \"en-US\",\n \"englishName\": \"English (United States)\"\n },\n \"targetLanguage\": {\n \"languageCode\": \"fr-FR\",\n \"englishName\": \"French (France)\"\n }\n }\n ],\n \"location\": {\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\",\n \"name\": \"Project Location\"\n }\n },\n {\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\",\n \"name\": \"Translation Project 2\",\n \"languageDirections\": [\n {\n \"sourceLanguage\": {\n \"languageCode\": \"en-US\",\n \"englishName\": \"English (United States)\"\n },\n \"targetLanguage\": {\n \"languageCode\": \"fr-FR\",\n \"englishName\": \"French (France)\"\n }\n }\n ],\n \"location\": {\n \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxx\",\n \"name\": \"Project Location\"\n }\n }\n ],\n \"itemCount\": 2\n}\n\n```\n\nMore details about this endpoint can be found [here](https://languagecloud.sdl.com/lc/api-docs/rest-api/project/listprojects)."
},
"response": []
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{lc_access_token}}",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "baseUrl",
"value": "https://lc-api.sdl.com/public-api/v1"
},
{
"key": "lc_access_token",
"value": ""
},
{
"key": "lc_tenant",
"value": "LC-ADD_TENANT_ID"
}
]
}