# URL Variações

## GET - Consultando a URL de uma variação

Para realizar a consulta da URL de uma variação deve-se utilizar o método GET, preenchendo os devidos headers, no endpoint abaixo:

```
https://api.skyhub.com.br/urls/products/{SKU}/variations/{SKU_VARIACAO}
```

{% hint style="info" %}
Note que na URL é preciso informar dois códigos SKU, sendo:

* **SKU**: Produto pai/agrupador;
* **SKU\_VARIACAO**: Código da variação a ser consultada.
  {% endhint %}

#### Request headers:

| Key                  | Value                                       |
| -------------------- | ------------------------------------------- |
| X-User-Email         | email\_de\_usuario                          |
| X-Api-Key            | token\_de\_integracao de sua conta SkyHub   |
| X-Accountmanager-Key | token\_account único de cada Plataforma/ERP |
| Accept               | application/json                            |
| Content-Type         | application/json                            |

#### Example request:

```
curl --location -g --request GET 'https://api.skyhub.com.br/urls/products/{sku}/variations/{variation_sku}' \
--header 'X-User-Email: email_de_usuario' \
--header 'X-Api-Key: token_de_integracao de sua conta SkyHub' \
--header 'X-Accountmanager-Key: token_account único de cada Plataforma/ERP' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```

#### Response esperado:

{% hint style="success" %}
200 - Success \[OK]
{% endhint %}

```
{
    "sku": "SKU_01A",
    "channels": [
        {
            "name": "Lojas Americanas",
            "href": "https://www.americanas.com.br/produto/4567845678?sellerId=34567899879879"
        },
        {
            "name": "Submarino",
            "href": "https://www.submarino.com.br/produto/4567845678?sellerId=34567899879879"
        },
        {
            "name": "Shoptime",
            "href": "https://www.shoptime.com.br/produto/4567845678?sellerId=34567899879879"
        }
    ]
}
```

### Como consultar as URLs das variações de um SKU

Para realizar a consulta das URLs de todas as variações de um SKU agrupador basta encaminhar via API uma requisição contendo o método GET no endpoint visto a seguir, utilizando os [headers](#request-headers) informados no início deste guia:

```
https://api.skyhub.com.br/urls/products/{SKU}/variations
```

{% hint style="info" %}
Na URL deve ser informado o **SKU pai/agrupador** cujas variações serão consultadas.&#x20;
{% endhint %}

#### Example request:

```
curl --location -g --request GET 'https://api.skyhub.com.br/urls/products/{SKU}/variations' \
--header 'X-User-Email: email_de_usuario' \
--header 'X-Api-Key: token_de_integracao de sua conta SkyHub' \
--header 'X-Accountmanager-Key: token_account único de cada Plataforma/ERP' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```

#### Response esperado:

{% hint style="success" %}
200 - Success \[OK]
{% endhint %}

```
{
    "variations": [
        {
            "sku": "SKU_01A",
            "channels": [
                {
                    "name": "Lojas Americanas",
                    "href": "https://www.americanas.com.br/produto/4567845678?sellerId=34567899879879"
                },
                {
                    "name": "Submarino",
                    "href": "https://www.submarino.com.br/produto/4567845678?sellerId=34567899879879"
                },
                {
                    "name": "Shoptime",
                    "href": "https://www.shoptime.com.br/produto/4567845678?sellerId=34567899879879"
                }
            ]
        },
        {
            "sku": "SKU_01B",
            "channels": [
                {
                    "name": "Lojas Americanas",
                    "href": "https://www.americanas.com.br/produto/4567845678?sellerId=34567899879879"
                },
                {
                    "name": "Submarino",
                    "href": "https://www.submarino.com.br/produto/4567845678?sellerId=34567899879879"
                },
                {
                    "name": "Shoptime",
                    "href": "https://www.shoptime.com.br/produto/4567845678?sellerId=34567899879879"
                }
            ]
        },
        {
            "sku": "SKU_01C",
            "channels": [
                {
                    "name": "Lojas Americanas",
                    "href": "https://www.americanas.com.br/produto/4567845678?sellerId=34567899879879"
                },
                {
                    "name": "Submarino",
                    "href": "https://www.submarino.com.br/produto/4567845678?sellerId=34567899879879"
                },
                {
                    "name": "Shoptime",
                    "href": "https://www.shoptime.com.br/produto/4567845678?sellerId=34567899879879"
                }
            ]
        }
    ]
}
```

### Filtros a serem aplicados

Há a possibilidade de aplicar filtros de acordo com as marcas que constituem o marketplace Americanas, a fim de realizar a listagem das URLs a partir dos valores Lojas Americanas, Shoptime ou Submarino.

Para a aplicação de filtro, deve-se incluir a query ***?channels\[]=*** no endpoint de consulta:

```
https://api.skyhub.com.br/urls/products/{SKU}/variations?channels[]={marca/canal}
```

#### Example request:

O exemplo disponibilizado a seguir utiliza o canal Lojas Americanas para aplicação do filtro:

```
curl --location -g --request GET 'https://api.skyhub.com.br/urls/products/{SKU}/variations?channels[]=Lojas Americanas' \
--header 'X-User-Email: email_de_usuario' \
--header 'X-Api-Key: token_de_integracao de sua conta SkyHub' \
--header 'X-Accountmanager-Key: token_account único de cada Plataforma/ERP' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```

#### Response esperado:

{% hint style="success" %}
200 - Success \[OK]: No retorno para a consulta acima serão visualizadas as URLs das Lojas Americanas para todas as variações do SKU referenciado:
{% endhint %}

```
{
    "variations": [
        {
            "sku": "SKU_01A",
            "channels": [
                {
                    "name": "Lojas Americanas",
                    "href": "https://www.americanas.com.br/produto/4567845678?sellerId=34567899879879"
                }
            ]
        },
        {
            "sku": "SKU_01B",
            "channels": [
                {
                    "name": "Lojas Americanas",
                    "href": "https://www.americanas.com.br/produto/4567845678?sellerId=34567899879879"
                }
            ]
        },
        {
            "sku": "SKU_01C",
            "channels": [
                {
                    "name": "Lojas Americanas",
                    "href": "https://www.americanas.com.br/produto/4567845678?sellerId=34567899879879"
                }
            ]
        }
    ]
}
```

{% hint style="info" %}
Também é possível aplicar o filtro por marca/canal de venda na consulta individual por variação, como exemplo a seguir:

`https://api.skyhub.com.br/urls/products/{SKU}/variations/{SKU_VARIACAO}?channels[]=Lojas Americanas`
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://desenvolvedores.skyhub.com.br/produtos/outros-recursos-de-produtos/consulta-url/url-variacoes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
