SkyHub API

attributes

Atributos dos produtos

attributes Overview

{
  "attribute": {
  "attribute": { ... }
Object
    "name": "att_name",
String

Identificador interno do atributo

    "label": "Atributo Exemplo",
String

Label do atributo. Essa é a string que será mostrada no portal da SkyHub.

    "options": [
    "foo",
    "foo",
    "foo"
  ]
Array

Campo opcional. Lista as opções do atributo, caso ele seja do tipo "select". Exemplo, [ "vermelho", "azul", "branco" ] para um atributo "Cor".

  }
}

Criar atributo

Open in API Explorer
POST /attributes

Criar um novo atributo de produto

Example Request

Format:
curl --request POST \
  --url https://desenvolvedores.skyhub.com.br/attributes \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-accountmanager-key: foo' \
  --header 'x-api-key: YOUR API KEY HERE' \
  --header 'x-user-email: MUDAR@SEU_EMAIL.COM' \
  --data '{"attribute":{"name":"att_name","label":"Atributo Exemplo","options":["foo","foo","foo"]}}'
require 'uri'
require 'net/http'

url = URI("https://desenvolvedores.skyhub.com.br/attributes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-api-key"] = 'YOUR API KEY HERE'
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["x-user-email"] = 'MUDAR@SEU_EMAIL.COM'
request["x-accountmanager-key"] = 'foo'
request.body = "{\"attribute\":{\"name\":\"att_name\",\"label\":\"Atributo Exemplo\",\"options\":[\"foo\",\"foo\",\"foo\"]}}"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "desenvolvedores.skyhub.com.br",
  "port": null,
  "path": "/attributes",
  "headers": {
    "x-api-key": "YOUR API KEY HERE",
    "accept": "application/json",
    "content-type": "application/json",
    "x-user-email": "MUDAR@SEU_EMAIL.COM",
    "x-accountmanager-key": "foo"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ attribute: 
   { name: 'att_name',
     label: 'Atributo Exemplo',
     options: [ 'foo', 'foo', 'foo' ] } }));
req.end();
import http.client

conn = http.client.HTTPSConnection("desenvolvedores.skyhub.com.br")

payload = "{\"attribute\":{\"name\":\"att_name\",\"label\":\"Atributo Exemplo\",\"options\":[\"foo\",\"foo\",\"foo\"]}}"

headers = {
    'x-api-key': "YOUR API KEY HERE",
    'accept': "application/json",
    'content-type': "application/json",
    'x-user-email': "MUDAR@SEU_EMAIL.COM",
    'x-accountmanager-key': "foo"
    }

conn.request("POST", "/attributes", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://desenvolvedores.skyhub.com.br/attributes",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"attribute\":{\"name\":\"att_name\",\"label\":\"Atributo Exemplo\",\"options\":[\"foo\",\"foo\",\"foo\"]}}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json",
    "x-accountmanager-key: foo",
    "x-api-key: YOUR API KEY HERE",
    "x-user-email: MUDAR@SEU_EMAIL.COM"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://desenvolvedores.skyhub.com.br/attributes"

	payload := strings.NewReader("{\"attribute\":{\"name\":\"att_name\",\"label\":\"Atributo Exemplo\",\"options\":[\"foo\",\"foo\",\"foo\"]}}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "YOUR API KEY HERE")
	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")
	req.Header.Add("x-user-email", "MUDAR@SEU_EMAIL.COM")
	req.Header.Add("x-accountmanager-key", "foo")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Request Headers

Name Type Required Description Example
Accept String Required application/json
Content-Type String Required application/json
X-User-Email String Required MUDAR@SEU_EMAIL.COM
x-accountmanager-key String Required

Identificador da sua integração com a SkyHub

foo

Request Body

Name Type Required Description Example
body Object Required
{
  "attribute": {
  "attribute": { ... }
Object
    "name": "att_name",
String

Identificador interno do atributo

    "label": "Atributo Exemplo",
String

Label do atributo. Essa é a string que será mostrada no portal da SkyHub.

    "options": [
    "foo",
    "foo",
    "foo"
  ]
Array

Campo opcional. Lista as opções do atributo, caso ele seja do tipo "select". Exemplo, [ "vermelho", "azul", "branco" ] para um atributo "Cor".

  }
}

Responses

201 Success

Atributo criado com sucesso

(Empty Response)
400 Error

Existe algum erro na requisição

(Empty Response)

Atualizar Atributo

Open in API Explorer
PUT /attributes/{name}

Example Request

Format:
curl --request PUT \
  --url https://desenvolvedores.skyhub.com.br/attributes/ATTRIBUTE_NAME \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-accountmanager-key: foo' \
  --header 'x-api-key: YOUR API KEY HERE' \
  --header 'x-user-email: MUDAR@SEU_EMAIL.COM' \
  --data '{"attribute":{"label":"Atributo Exemplo","options":["azul","azul","azul"]}}'
require 'uri'
require 'net/http'

url = URI("https://desenvolvedores.skyhub.com.br/attributes/ATTRIBUTE_NAME")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["x-api-key"] = 'YOUR API KEY HERE'
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request["x-user-email"] = 'MUDAR@SEU_EMAIL.COM'
request["x-accountmanager-key"] = 'foo'
request.body = "{\"attribute\":{\"label\":\"Atributo Exemplo\",\"options\":[\"azul\",\"azul\",\"azul\"]}}"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "PUT",
  "hostname": "desenvolvedores.skyhub.com.br",
  "port": null,
  "path": "/attributes/ATTRIBUTE_NAME",
  "headers": {
    "x-api-key": "YOUR API KEY HERE",
    "content-type": "application/json",
    "accept": "application/json",
    "x-user-email": "MUDAR@SEU_EMAIL.COM",
    "x-accountmanager-key": "foo"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ attribute: 
   { label: 'Atributo Exemplo',
     options: [ 'azul', 'azul', 'azul' ] } }));
req.end();
import http.client

conn = http.client.HTTPSConnection("desenvolvedores.skyhub.com.br")

payload = "{\"attribute\":{\"label\":\"Atributo Exemplo\",\"options\":[\"azul\",\"azul\",\"azul\"]}}"

headers = {
    'x-api-key': "YOUR API KEY HERE",
    'content-type': "application/json",
    'accept': "application/json",
    'x-user-email': "MUDAR@SEU_EMAIL.COM",
    'x-accountmanager-key': "foo"
    }

conn.request("PUT", "/attributes/ATTRIBUTE_NAME", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://desenvolvedores.skyhub.com.br/attributes/ATTRIBUTE_NAME",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\"attribute\":{\"label\":\"Atributo Exemplo\",\"options\":[\"azul\",\"azul\",\"azul\"]}}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json",
    "x-accountmanager-key: foo",
    "x-api-key: YOUR API KEY HERE",
    "x-user-email: MUDAR@SEU_EMAIL.COM"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://desenvolvedores.skyhub.com.br/attributes/ATTRIBUTE_NAME"

	payload := strings.NewReader("{\"attribute\":{\"label\":\"Atributo Exemplo\",\"options\":[\"azul\",\"azul\",\"azul\"]}}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("x-api-key", "YOUR API KEY HERE")
	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "application/json")
	req.Header.Add("x-user-email", "MUDAR@SEU_EMAIL.COM")
	req.Header.Add("x-accountmanager-key", "foo")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
name String Required

Nome (código) interno do atributo

ATTRIBUTE_NAME

Request Headers

Name Type Required Description Example
Content-Type String Required application/json
Accept String Required application/json
X-User-Email String (email) Required MUDAR@SEU_EMAIL.COM
x-accountmanager-key String Required

Identificador da sua integração com a SkyHub

foo

Request Body

Name Type Required Description Example
body Object Required

Dados do atributo que serão atualizados

{
  "attribute": {
  "attribute": { ... }
Object
    "label": "Atributo Exemplo",
String

Label do atributo. Essa é a string que será mostrada no portal da SkyHub.

    "options": [
    "azul",
    "azul",
    "azul"
  ]
Array

Campo opcional. Lista as opções do atributo caso ele seja do tipo "select". Exemplo, [ "vermelho", "azul", "branco" ] para um atributo "Cor".

  }
}

Responses

204 Success

Atributo atualizado com sucesso

(Empty Response)
404 Atributo não encontrado

O nome do atributo passado na URL não foi encontrado

(Empty Response)