Skip to content

Commit 798aa8b

Browse files
committed
PIM-7802-7803: upsert one or several reference entity attributes
1 parent 2908d9d commit 798aa8b

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
type: array
2+
items:
3+
$ref: ../definitions/reference_entity_attribute.yaml
4+
example: [
5+
{
6+
"code": "description",
7+
"labels": {
8+
"en_US": "Description",
9+
"fr_FR": "Description"
10+
},
11+
"type": "text",
12+
"localizable": true,
13+
"scopable": false,
14+
"max_characters": null,
15+
"is_textarea": true,
16+
"is_rich_text_editor": true,
17+
"validation_rule": null,
18+
"validation_regexp": null
19+
},
20+
{
21+
"code": "country",
22+
"labels": {
23+
"en_US": "Country",
24+
"fr_FR": "Pays"
25+
},
26+
"type": "text",
27+
"localizable": true,
28+
"scopable": false,
29+
"max_characters": 100,
30+
"is_textarea": false,
31+
"is_rich_text_editor": null,
32+
"validation_rule": null,
33+
"validation_regexp": null
34+
},
35+
{
36+
"code": "collection_overview",
37+
"labels": {
38+
"en_US": "Collection overview",
39+
"fr_FR": "Aperçu de la collection"
40+
},
41+
"type": "image",
42+
"localizable": true,
43+
"scopable": false,
44+
"allowed_extensions": ["png"],
45+
"max_file_size": "1000"
46+
}
47+
]

content/swagger/resources/reference_entity_attributes/routes/reference_entity_attributes.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,47 @@ get:
7474
$ref: "#/responses/401Error"
7575
406:
7676
$ref: "#/responses/406Error"
77+
patch:
78+
summary: Update/create several attributes of a given reference entity
79+
operationId: "patch_reference_entity_attributes"
80+
tags:
81+
- Reference entity attribute
82+
x-versions:
83+
- "3.0"
84+
x-ee: true
85+
description: This endpoint allows you to update and/or create several reference entity attributes at once. Note that if the attribute does not already exist for the given reference entity, it creates it.
86+
parameters:
87+
- $ref: '#/parameters/reference_entity_code'
88+
- name: body
89+
in: body
90+
required: true
91+
schema:
92+
$ref: ../definitions/reference_entity_attributes.yaml
93+
responses:
94+
200:
95+
description: OK
96+
x-details: Returns an JSON array in which each object gives you the status of each attribute creation or update
97+
x-no-entity: true
98+
schema:
99+
$ref: '#/definitions/ErrorByObject'
100+
x-examples: [
101+
{
102+
"code": "description",
103+
"status_code": 204
104+
},
105+
{
106+
"code": "country",
107+
"status_code": 422,
108+
"message": "Property 'group' does not exist."
109+
},
110+
{
111+
"code": "collection_overview",
112+
"status_code": 201
113+
}
114+
]
115+
401:
116+
$ref: "#/responses/401Error"
117+
413:
118+
$ref: "#/responses/413Error"
119+
415:
120+
$ref: "#/responses/415ErrorStream"

content/swagger/resources/reference_entity_attributes/routes/reference_entity_attributes_code.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,31 @@ get:
2222
$ref: "#/responses/406Error"
2323
404:
2424
$ref: "#/responses/404Error"
25+
patch:
26+
summary: Update/create an attribute of a given reference entity
27+
operationId: "patch_reference_entity_attributes__code_"
28+
tags:
29+
- Reference entity attribute
30+
x-versions:
31+
- "3.0"
32+
x-ee: true
33+
description: This endpoint allows you to update a given attribute for a given renference entity. Note that if the attribute does not already exist for the given reference entity, it creates it.
34+
parameters:
35+
- $ref: '#/parameters/reference_entity_code'
36+
- $ref: '#/parameters/code'
37+
- name: body
38+
in: body
39+
required: true
40+
schema:
41+
$ref: ../definitions/reference_entity_attribute.yaml
42+
responses:
43+
201:
44+
$ref: "#/responses/Created"
45+
204:
46+
$ref: "#/responses/NoContent"
47+
401:
48+
$ref: "#/responses/401Error"
49+
415:
50+
$ref: "#/responses/415Error"
51+
422:
52+
$ref: "#/responses/422Error"

0 commit comments

Comments
 (0)