Skip to content

Commit a05457a

Browse files
committed
PIM-7808-7809: Upsert one or several ref entity attribute options
1 parent 49d5066 commit a05457a

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed

content/rest-api/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ In 2.3, we added in the API the following entity:
123123
To finish, in 3.0, we added in the API the following entities:
124124
- [Reference entity](/documentation/resources.html#reference-entity-3x-and-ee-only) (Enterprise edition only),
125125
- [Reference entity attribute](/documentation/resources.html#reference-entity-attribute-3x-and-ee-only) (Enterprise edition only),
126+
- [Reference entity attribute option](/documentation/resources.html#reference-entity-attribute-option-3x-and-ee-only) (Enterprise edition only),
126127
- [Reference entity record](/documentation/resources.html#reference-entity-record-3x-and-ee-only) (Enterprise edition only),
127128
- [Record media file](/documentation/resources.html#record-media-file-3x-and-ee-only) (Enterprise edition only).
128129

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
type: array
2+
items:
3+
$ref: ../definitions/reference_entity_attribute_option.yaml
4+
example: [
5+
{
6+
"code": "woodland_retreat",
7+
"labels": {
8+
"en_US": "Woodland Retreat",
9+
"fr_FR": "Retraite dans les Bois"
10+
}
11+
},
12+
{
13+
"code": "new_nordic",
14+
"labels": {
15+
"en_US": "New Nordic",
16+
"fr_FR": "Renouveau Scandinave"
17+
}
18+
},
19+
{
20+
"code": "global_nomad",
21+
"labels": {
22+
"en_US": "Global Nomad",
23+
"fr_FR": "Nomade du Monde"
24+
}
25+
}
26+
]

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,50 @@ get:
8484
$ref: "#/responses/401Error"
8585
406:
8686
$ref: "#/responses/406Error"
87+
patch:
88+
summary: Update/create several reference entity attribute options
89+
operationId: "patch_reference_entity_attributes__attribute_code__options"
90+
tags:
91+
- Reference entity attribute option
92+
x-versions:
93+
- "3.0"
94+
x-ee: true
95+
description: This endpoint allows you to update several options for a given attribute and a given reference entity at once.
96+
x-body-by-line: Contains several lines, each line is a reference entity attribute option in JSON standard format
97+
parameters:
98+
- $ref: '#/parameters/reference_entity_code'
99+
- $ref: '#/parameters/attribute_code'
100+
- name: body
101+
in: body
102+
schema:
103+
$ref: ../definitions/reference_entity_attribute_options.yaml
104+
responses:
105+
200:
106+
description: OK
107+
x-details: Returns an JSON array in which each object gives you the status of each reference entity attribute option creation or update
108+
x-no-entity: true
109+
schema:
110+
$ref: '#/definitions/ErrorByObject'
111+
x-examples: [
112+
{
113+
"code": "woodland_retreat",
114+
"status_code": 204
115+
},
116+
{
117+
"code": "new_nordic",
118+
"status_code": 422,
119+
"message": "Property 'group' does not exist."
120+
},
121+
{
122+
"code": "global_nomad",
123+
"status_code": 201
124+
}
125+
]
126+
401:
127+
$ref: "#/responses/401Error"
128+
403:
129+
$ref: "#/responses/403Error"
130+
413:
131+
$ref: "#/responses/413Error"
132+
415:
133+
$ref: "#/responses/415ErrorStream"

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

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

0 commit comments

Comments
 (0)