-
Notifications
You must be signed in to change notification settings - Fork 133
/
VTEX - Buyer Organizations.json
554 lines (554 loc) · 33.6 KB
/
VTEX - Buyer Organizations.json
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
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
{
"openapi": "3.0.0",
"info": {
"title": "Buyer Organizations",
"description": "The Buyer Organizations API facilitates the bulk import of [Buyer Organizations](https:\/\/developers.vtex.com\/docs\/apps\/vtex.b2b-organizations), [Cost Centers](https:\/\/developers.vtex.com\/docs\/guides\/vtex-b2b-organizations#cost-centers), and [Members](https:\/\/developers.vtex.com\/docs\/guides\/vtex-b2b-organizations#users). By allowing spreadsheet import, this API simplifies the management of buyer organizations and allows easy updating and maintenance of information in B2B stores.\r\n\r\n>\u2139 \uFE0FOnly `.xlsx` files under 50MB in size can be imported. You can [download the template file](https:\/\/io.vtex.com.br\/b2b-bulk-import\/b2b-bulk-import-template.xlsx) as an example. For more information on the file structure and how to fill it out, access the [Bulk Import Buyer Organizations Spreadsheet](https:\/\/developers.vtex.com\/docs\/guides\/bulk-import-buyer-organizations-spreadsheet) guide.\r\n\r\n## Index\r\n\r\n- `POST` [Upload file](https:\/\/developers.vtex.com\/docs\/api-reference\/buyer-organizations#post-\/api\/b2b\/import\/buyer-orgs)\r\n- `GET` [Check progress](https:\/\/developers.vtex.com\/docs\/api-reference\/buyer-organizations#get-\/api\/b2b\/import\/buyer-orgs\/-importId-)\r\n- `POST` [Start import](https:\/\/developers.vtex.com\/docs\/api-reference\/buyer-organizations#post-\/api\/b2b\/import\/buyer-orgs\/-importId-)\r\n- `POST` [Validate file](https:\/\/developers.vtex.com\/docs\/api-reference\/buyer-organizations#post-\/api\/b2b\/import\/buyer-orgs\/validate\/-importId-)\r\n\r\n## Common parameters in the documentation\r\n\r\n| Parameter name | Description |\r\n| - | - |\r\n| `{{accountName}}` | Name of the VTEX account. Used as part of the URL. |\r\n| `{{environment}}` | Environment to use. Used as part of the URL. |\r\n| `{{X-VTEX-API-AppKey}}` | Unique identifier of the [application key](https:\/\/developers.vtex.com\/docs\/guides\/api-authentication-using-application-keys). |\r\n| `{{X-VTEX-API-AppToken}}` | Secret token of the [application key](https:\/\/developers.vtex.com\/docs\/guides\/api-authentication-using-application-keys). |",
"version": "1.0"
},
"servers": [
{
"url": "https://{accountName}.{environment}.com.br",
"description": "VTEX server URL.",
"variables": {
"accountName": {
"description": "Name of the VTEX account. Used as part of the URL.",
"default": "apiexamples"
},
"environment": {
"description": "Environment to use. Used as part of the URL.",
"enum": [
"vtexcommercestable"
],
"default": "vtexcommercestable"
}
}
}
],
"paths": {
"/api/b2b/import/buyer-orgs": {
"post": {
"tags": [
"Bulk Import"
],
"summary": "Upload file",
"description": "Uploads a file for bulk import of Buyer Organizations, Cost Centers and Members. The uploaded file should be in `XLSX` format and have less than 50MB. For more information on the file structure and how to fill it out, access the [Bulk Import Spreadsheet](https:\/\/developers.vtex.com\/docs\/guides\/bulk-import-buyer-organizations-spreadsheet) guide.\r\n\r\n## Permissions\r\n\r\nAny user or [application key](https:\/\/developers.vtex.com\/docs\/guides\/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https:\/\/help.vtex.com\/en\/tutorial\/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:\r\n\r\n| **Product** | **Category** | **Resource** |\r\n| --------------- | ----------------- | ----------------- |\r\n| B2B | B2B General | **B2BBulkImport** |\r\n\r\nThere are no applicable [predefined roles](https:\/\/help.vtex.com\/en\/tutorial\/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https:\/\/help.vtex.com\/en\/tutorial\/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https:\/\/developers.vtex.com\/docs\/guides\/authentication).\r\n\r\n>\u2757 To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https:\/\/help.vtex.com\/en\/tutorial\/best-practices-application-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations.",
"operationId": "UploadFile",
"parameters": [
{
"$ref": "#/components/parameters/Content-Type-Multipart"
},
{
"$ref": "#/components/parameters/an"
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"encoding": {},
"schema": {
"required": [
"file"
],
"type": "object",
"properties": {
"file": {
"type": "string",
"format": "binary",
"description": "File to be uploaded.",
"example": "file.xlsx"
}
}
}
}
},
"required": false
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/file-data"
},
"example": {
"accountName": "accountName",
"importId": "3c3cba0a-8355-4812-ad4d-f4c0b32e2613",
"importState": "Uploaded",
"percentage": "0",
"lastUpdateDate": "2023-10-05T16:40:11+00:00",
"fileName": "file.xlsx"
}
}
}
}
}
}
},
"/api/b2b/import/buyer-orgs/{importId}": {
"get": {
"tags": [
"Bulk Import"
],
"summary": "Check progress",
"description": "Checks the progress of a started file validation or import process. After initiating validation using [Validate file](https://developers.vtex.com/docs/api-reference/buyer-organizations#post-/api/b2b/import/buyer-orgs/validate/-importId-) or import using [Start import](https://developers.vtex.com/docs/api-reference/buyer-organizations#post-/api/b2b/import/buyer-orgs/-importId-), you can track progress by sending a request to this endpoint. \r\n\r\n## Permissions\r\n\r\nAny user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:\r\n\r\n| **Product** | **Category** | **Resource** |\r\n| --------------- | ----------------- | ----------------- |\r\n| B2B | B2B General | **B2BBulkImport** |\r\n\r\nThere are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication).\r\n\r\n>❗ To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https://help.vtex.com/en/tutorial/best-practices-application-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations.",
"operationId": "CheckProgress",
"parameters": [
{
"$ref": "#/components/parameters/Content-Type"
},
{
"$ref": "#/components/parameters/an"
},
{
"$ref": "#/components/parameters/importId"
}
],
"responses": {
"200": {
"description": "Response containing the details of the file validation or import.",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/file-data"
},
{
"$ref": "#/components/schemas/importResult"
},
{
"$ref": "#/components/schemas/validationResult"
}
]
},
"examples": {
"ValidationDetails": {
"value": {
"accountName": "accountName",
"importId": "3c3cba0a-8355-4812-ad4d-f4c0b32e2613",
"importState": "InValidation",
"percentage": "0",
"lastUpdateDate": "2023-10-05T16:40:11+00:00",
"fileName": "file.xlsx"
}
},
"ImportDetails": {
"value": {
"accountName": "accountName",
"importId": "3c3cba0a-8355-4812-ad4d-f4c0b32e2613",
"importState": "Completed",
"percentage": "100",
"lastUpdateDate": "2023-10-05T16:41:11+00:00",
"fileName": "file.xlsx"
}
},
"ValidationErrorsDetails": {
"value": {
"accountName": "accountName",
"importId": "71411025-c7d9-4c9d-92b5-9bc70a1acdb7",
"importState": "ValidationFailed",
"percentage": "0",
"lastUpdateDate": "2024-02-21T17:56:57+00:00",
"fileName": "file.xlsx",
"validationResult": {
"isValid": false,
"validationResult": [
{
"name": "Organizations",
"validRows": 0,
"invalidRows": 1
},
{
"name": "Cost Centers",
"validRows": 0,
"invalidRows": 0
},
{
"name": "Members",
"validRows": 0,
"invalidRows": 0
}
]
}
}
},
"ImportErrorsDetails": {
"value": {
"accountName": "accountName",
"importId": "d51b1b09-b4f3-44a3-ad70-53b9c8fe35f4",
"importState": "CompletedWithError",
"percentage": "100",
"lastUpdateDate": "2024-02-26T14:47:10+00:00",
"fileName": "test-26-fev-bulk-import-error.xlsx",
"importResult": {
"imports": [
{
"name": "Organizations",
"importedRows": 2,
"rowsWithError": 1
}
],
"reportDownloadLink": "https://host.com/files/accountName/d51b1b09-b4f3-44a3-ad70-53b9c8fe35f4/file-error_Report.xlsx"
},
"importedAt": "2024-02-26T14:47:05+00:00",
"importedUserEmail": "[email protected]",
"importedUserName": "user"
}
}
}
}
}
}
}
},
"post": {
"tags": [
"Bulk Import"
],
"summary": "Start import",
"description": "Once the file is successfully uploaded and validated, you can call this endpoint to start the import. Provide the `importId` returned by the [Validate file](https:\/\/developers.vtex.com\/docs\/api-reference\/buyer-organizations#post-\/api\/b2b\/import\/buyer-orgs\/validate\/-importId-) or [Upload file](https:\/\/developers.vtex.com\/docs\/api-reference\/buyer-organizations#post-\/api\/b2b\/import\/buyer-orgs) endpoints. \r\n\r\n## Permissions\r\n\r\nAny user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:\r\n\r\n| **Product** | **Category** | **Resource** |\r\n| --------------- | ----------------- | ----------------- |\r\n| B2B | B2B General | **B2BBulkImport** |\r\n\r\nThere are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication).\r\n\r\n>❗ To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https://help.vtex.com/en/tutorial/best-practices-application-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations.",
"parameters": [
{
"$ref": "#/components/parameters/Content-Type"
},
{
"$ref": "#/components/parameters/an"
},
{
"$ref": "#/components/parameters/importId"
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/api/b2b/import/buyer-orgs/validate/{importId}": {
"post": {
"tags": [
"Bulk Import"
],
"summary": "Validate file",
"description": "Starts the bulk import file content validation. Once the the file is successfully uploaded, you can start the validation using the `importId` returned by the [Upload file](https://developers.vtex.com/docs/api-reference/buyer-organizations#post-/api/b2b/import/buyer-orgs) endpoint. \n\n## Permissions\n\nAny user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:\n\n| **Product** | **Category** | **Resource** |\n| --------------- | ----------------- | ----------------- |\n| B2B | B2B General | **B2BBulkImport** |\n\nThere are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication).\n\n>❗ To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https://help.vtex.com/en/tutorial/best-practices-application-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations.",
"operationId": "ValidateFile",
"parameters": [
{
"$ref": "#/components/parameters/Content-Type"
},
{
"$ref": "#/components/parameters/an"
},
{
"$ref": "#/components/parameters/importId"
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
}
},
"components": {
"parameters": {
"Content-Type": {
"name": "Content-Type",
"in": "header",
"description": "Type of the content being sent.",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"example": "application/json"
}
},
"Content-Type-Multipart": {
"name": "Content-Type",
"in": "header",
"description": "Type of the content being sent.",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"example": "multipart/form-data"
}
},
"an": {
"name": "an",
"in": "query",
"description": "Name of your VTEX account.",
"required": false,
"style": "form",
"schema": {
"type": "string",
"example": "exampleAccount"
}
},
"accountName": {
"name": "accountName",
"in": "path",
"required": true,
"description": "Name of your VTEX account.",
"schema": {
"type": "string",
"example": "apiexamples"
}
},
"environment": {
"name": "environment",
"in": "path",
"required": true,
"description": "Environment to be used in the request.",
"schema": {
"type": "string",
"default": "vtexcommercestable"
}
},
"importId": {
"name": "importId",
"in": "path",
"required": true,
"description": "Unique identifier of the import.",
"schema": {
"type": "string",
"example": "3c3cba0a-8355-4812-ad4d-f4c0b32e2613"
}
}
},
"schemas": {
"file-data": {
"type": "object",
"description": "Object containing information about bulk import state.",
"required": [
"accountName",
"importId",
"importState",
"percentage",
"lastUpdateDate",
"fileName"
],
"properties": {
"accountName": {
"type": "string",
"description": "Name of your VTEX account."
},
"importId": {
"type": "string",
"description": "Unique identifier of the import."
},
"importState": {
"type": "string",
"description": "Current state of the import. The possible values are:\n- `Uploaded`: The file was successfully uploaded.\n- `InValidation`: File validation is in progress.\n- `ReadyToImport`: File validation completed, ready for import.\n- `Completed`: File successfully imported.\n- `ValidationFailed`: File validation failed.\n- `CompletedWithError`: File import failed."
},
"percentage": {
"type": "string",
"description": "Completion percentage of the import."
},
"lastUpdateDate": {
"type": "string",
"description": "Date and time of the last update of the import, in `yyyy-mm-ddTHH:MM:SS+00:00` format."
},
"fileName": {
"type": "string",
"description": "Name of the file being imported."
}
}
},
"importResult": {
"type": "object",
"description": "Object containing information about bulk import state.",
"required": [
"accountName",
"importId",
"importState",
"percentage",
"lastUpdateDate",
"fileName",
"importResult",
"importedAt",
"importedUserEmail",
"importedUserName"
],
"properties": {
"accountName": {
"type": "string",
"description": "Name of your VTEX account."
},
"importId": {
"type": "string",
"description": "Unique identifier of the import."
},
"importState": {
"type": "string",
"description": "Current state of the import. The possible values are:\n- `Uploaded`: The file was successfully uploaded.\n- `InValidation`: File validation is in progress.\n- `ReadyToImport`: File validation completed, ready for import.\n- `Completed`: File successfully imported.\n- `ValidationFailed`: File validation failed.\n- `CompletedWithError`: File import failed."
},
"percentage": {
"type": "string",
"description": "Completion percentage of the import."
},
"lastUpdateDate": {
"type": "string",
"description": "Date and time of the last update of the import, in `yyyy-mm-ddTHH:MM:SS+00:00` format."
},
"fileName": {
"type": "string",
"description": "Name of the file being imported."
},
"importedAt": {
"type": "string",
"description": "Date and time when the import was completed, in `yyyy-mm-ddTHH:MM:SS+00:00` format."
},
"importedUserEmail": {
"type": "string",
"description": "Email address of the user who performed the import."
},
"importedUserName": {
"type": "string",
"description": "Name of the user who performed the import."
},
"importResult": {
"type": "object",
"description": "Information about the outcome of the bulk import operation.",
"properties": {
"reportDownloadLink": {
"type": "string",
"description": "A link to download a detailed report on the outcome of the bulk import."
},
"imports": {
"type": "array",
"description": "Detailed information about the imported items.",
"items": {
"type": "object",
"description": "Object with detailed information.",
"properties": {
"name": {
"type": "string",
"description": "Unique identifier associated with the imported item."
},
"importedRows": {
"type": "integer",
"description": "Total number of lines successfully imported."
},
"rowsWithError": {
"type": "integer",
"description": "Total number of lines that encountered errors during import."
}
}
}
}
}
}
}
},
"validationResult": {
"type": "object",
"description": "Object containing information about bulk import state.",
"required": [
"accountName",
"importId",
"importState",
"percentage",
"lastUpdateDate",
"fileName",
"validationResult"
],
"properties": {
"accountName": {
"type": "string",
"description": "Name of your VTEX account."
},
"importId": {
"type": "string",
"description": "Unique identifier of the import."
},
"importState": {
"type": "string",
"description": "Current state of the import. The possible values are:\n- `Uploaded`: The file was successfully uploaded.\n- `InValidation`: File validation is in progress.\n- `ReadyToImport`: File validation completed, ready for import.\n- `Completed`: File successfully imported.\n- `ValidationFailed`: File validation failed.\n- `CompletedWithError`: File import failed."
},
"percentage": {
"type": "string",
"description": "Completion percentage of the import."
},
"lastUpdateDate": {
"type": "string",
"description": "Date and time of the last update of the import, in `yyyy-mm-ddTHH:MM:SS+00:00` format."
},
"fileName": {
"type": "string",
"description": "Name of the file being imported."
},
"validationResult": {
"type": "object",
"description": "Information about the result of bulk imported data validation.",
"properties": {
"isValid": {
"type": "boolean",
"description": "Indicates whether the bulk import operation was successful."
},
"validationResult": {
"type": "array",
"description": "Detailed information about the validation results.",
"items": {
"type": "object",
"description": "Object with detailed information.",
"properties": {
"name": {
"type": "string",
"description": "Unique identifier associated with the imported item."
},
"validRows": {
"type": "integer",
"description": "Total number of lines successfully validated."
},
"invalidRows": {
"type": "integer",
"description": "Number of imported lines that failed validation."
}
}
}
}
}
}
}
}
},
"securitySchemes": {
"appKey": {
"type": "apiKey",
"in": "header",
"name": "X-VTEX-API-AppKey",
"description": "Unique identifier of the [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys)."
},
"appToken": {
"type": "apiKey",
"in": "header",
"name": "X-VTEX-API-AppToken",
"description": "Secret token of the [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys)."
},
"VtexIdclientAutCookie": {
"type": "apiKey",
"in": "header",
"name": "VtexIdclientAutCookie",
"description": "[User token](https://developers.vtex.com/docs/guides/api-authentication-using-user-tokens), valid for 24 hours."
}
}
},
"tags": [
{
"name": "Bulk Import"
}
],
"security": [
{
"appKey": [],
"appToken": []
},
{
"VtexIdclientAutCookie": []
}
]
}