allegro / allegro/allegro-api

[NEWS] Parametry zależne - udostępniamy nowe pola / New fields for dependent parameters

Ouverte
#3,038 6 commentaires 0 réactions 1 personne assignée Réclamée par @PrzemyslawLukanowski Voir sur GitHub
News
Langage dominant
Aucune donnée de langage
Étoiles
244
Forks
40
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Parametry zależne to parametry:
- dla których zbiór dostępnych wartości jest uzależniony od wartości innego parametru. Przykładem może być Model, ponieważ dostępne wartości będą uzależnione od tego, jaką wartość wybierzesz dla parametru Marka, np. jeśli jako Markę wskażesz Nokia, dostępne wartości dla parametru Model zawęzimy do modeli Nokii,
- które będą dostępne w zależności od wyboru wartości innego parametru, np. (przykład teoretyczny) jeżeli chcesz wystawić Bransoletkę i jako wartość parametru Materiał wybierzesz złoto, pojawi się parametr Próba złota.

Aktualnie skupiamy się na zależnościach między wybranym parametrem, a zbiorem dostępnych wartości parametru zależnego.

**Parametry zależne planujemy stopniowo wdrażać w wybranych kategoriach**, w najbliższym czasie wprowadzimy je w kategorii Klipsy (123428). O kolejnych kategoriach i parametrach będziemy informować na [stronie dla sprzedających](https://allegro.pl/dla-sprzedajacych). Parametry mogą być obowiązkowe, sprawdzisz to w polu required w odpowiedzi dla [GET /sale/categories/{categoryId}/parameters](https://developer.allegro.pl/documentation/#operation/getFlatParametersUsingGET_2).
Za pomocą tej funkcjonalności w przyszłości ograniczymy liczbę dostępnych podkategorii, dzięki czemu uprościmy nawigację, np. Sprzedający wystawi przedmiot “Nokia 8” już w kategorii nadrzędnej “Smartfony i telefony komórkowe” - wystarczy, że odpowiednio określi Markę i Model.

W związku z tym udostępniliśmy nowe pola w odpowiedzi dla [GET /sale/categories/{categoryId}/parameters](https://developer.allegro.pl/documentation/#operation/getFlatParametersUsingGET_2):

- **dependsOnParameterId** w sekcji options. Wskazujemy w nim **identyfikator parametru** “**A**”, od którego zależne są wartości parametru “**B**”, np. dla parametru **Model** (parametr “B”) zwrócimy identyfikator parametru **Marka** (parametr “A”).
- Identyfikator parametru w tym polu zwracamy tylko dla parametrów typu dictionary, w pozostałych przypadkach odpowiemy wartością null,
- **dependsOnValueIds** - w sekcji dictionary. Zwracamy w nim **identyfikator wartości** parametru “**A**”, od którego zależna jest dana wartość parametru “**B**”.

Po tym, jak wprowadzimy pierwsze parametry zależne, nowe pola pomogą ci sprawdzić, czy próbujesz wystawić ofertę z poprawną kombinacją wartości parametrów, np. czy Nokia produkuje model, który przekazujesz w żądaniu.

Początkowo nie będziemy zwracać błędów, jeśli nie powiążesz poprawnie parametrów zależnych. Jeżeli parametr oznaczymy jako obowiązkowy, będziesz musiał uzupełnić wartość, jednak zignorujemy zależność między parametrami. Gdy zdecydujemy się wprowadzić walidację, poinformujemy o tym z odpowiednim wyprzedzeniem.

Poniżej znajdziesz przykład struktury, który tłumaczy mechanizm parametrów zależnych:


```
{
"id": "1254",
"name": "Model",
"type": "dictionary",
"required": false,
"unit": null,
"options": {
"variantsAllowed": true,
"variantsEqual": false,
"ambiguousValueId": "1254_17231",
"dependsOnParameterId": "202689" -- identyfikator parametru, który
definiuje, jakich wartości można użyć
dla tego parametru.
W tym przypadku oznacza to, że
wartości parametru Model są zależne
od wartości parametru Marka.
},
"dictionary": [
{
"id": "1254_1",
"value": "Galaxy S20",
"dependsOnValueIds": [
"202689_213101" -- identyfikator wartości, od której
zależna jest wartość tego parametru.
W tym przypadku wskazuje na markę
Samsung.
]
},
{
"id": "1254_2",
"value": "Galaxy S20+",
"dependsOnValueIds": [
"202689_213101"
]
},
{...},
{
"id": "1254_3",
"value": "520 Lumia",
"dependsOnValueIds": [
"202689_213102" -- w tym przypadku wartość wskazuje
na markę Nokia
]
},
{...},
{
"id": "1254_4",
"value": "Mi Note 10",
"dependsOnValueIds": [
"202689_213103" -- w tym przypadku wartość wskazuje
na markę Xiaomi
]
},
{
"id": "1254_5",
"value": "Mi Note 10 Pro",
"dependsOnValueIds": [
"202689_213103"
]
}
]}
```

-----

Dependent parameters are parameters:

- for which a set of available values depends on the value of the another parameter. Dependent parameter can be **Model**, because available values will depend on value provided in **Brand** parameter, e.g. if you select Nokia as Brand, Model parameter values will be limited to Nokia models only,
- which will be available depending on the choice of another parameter value, e.g. (theoretical example) if you want to list a bracelet and as a value for **Material** parameter you will select gold, there will be another parameter - **Millesimal fineness**.
Currently, we focus on dependency between selected parameter and set of available values for dependent parameter.

**We plan to introduce dependent parameters gradually in selected categories**, the first will appear in Clips category (123428). We will inform you about next categories and parameters on the [sellers page](https://allegro.pl/dla-sprzedajacych). The parameters may be required, you can check it in the ‘required’ field in the response for [GET /sale/categories/{categoryId}/parameters](https://developer.allegro.pl/documentation/#operation/getFlatParametersUsingGET_2).
Owing to this solution we will limit the number of available categories in the future, which will simplify navigation, e.g. seller will list “Nokia 8” already in the parent category “Smartphones and mobilephones” - specifying Brand and Model accordingly.

Therefore, we have introduced new fields in response to GET /sale/categories/{categoryId}/parameters:

- **dependsOnParameterId** in options section. Returned id for “A” parameter, indicates can be provided in “B” parameter, e.g. for the **Model** parameter (parameter "B") we will return the id of the parameter **Brand** (parameter "A")
Parameter id in this field is returned only for dictionary type parameters , in other cases we will return null value,
- **dependsOnValueIds** in dictionary section. We return the **identifier of the value** of the "A" parameter with which the value of the "B" depends on.

When we introduce first dependent parameters, new fields will help you check whether you are trying to list offer with valid combination of parameter values, e.g. whether Nokia is producing the model provided in the request.

Initially, we won’t return errors, if you don’t bind correctly dependent parameters. If parameter will be required, you will need to provide value, but we will ignore the dependency between the parameters. We will inform you in advance, when more strict validation will be implemented.

Below you can find example of a structure that explains the dependent parameters functionality:

```

{
"id": "1254",
"name": "Model",
"type": "dictionary",
"required": false,
"unit": null,
"options": {
"variantsAllowed": true,
"variantsEqual": false,
"ambiguousValueId": "1254_17231",
"dependsOnParameterId": "202689" -- values in the dictionary depend on
the parameter referenced by this field.
In this case it means that values
for Model parameter depends on
Brand parameter value.

},
"dictionary": [
{
"id": "1254_1",
"value": "Galaxy S20",
"dependsOnValueIds": [
"202689_213101" -- the ID of the dictionary value
from parameter that this parameter
value depends on.
In this case it indicates Samsung brand.
]
},
{
"id": "1254_2",
"value": "Galaxy S20+",
"dependsOnValueIds": [
"202689_213101"
]
},
{...},
{
"id": "1254_3",
"value": "520 Lumia",
"dependsOnValueIds": [
"202689_213102" -- in this case it indicates Nokia brand.
]
},
{...},
{
"id": "1254_4",
"value": "Mi Note 10",
"dependsOnValueIds": [
"202689_213103" -- in this case it indicates Xiaomi brand.
]
},
{
"id": "1254_5",
"value": "Mi Note 10 Pro",
"dependsOnValueIds": [
"202689_213103"
]
}
]}

```

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.