SkyHub API

Postagem (PLP)

Para pedidos B2W Entregas e B2W Direct não é necessário enviar os dados de entrega (tracking), pois o fluxo será atualizado pela B2W.

Listar PLPs

Open in API Explorer
GET /shipments/b2w/

Função que permite verificar na API todas as PLPs agrupadas. No retorno será possível verificar o ID da PLP e os pedidos inseridos em cada agrupamento.

Example Request

Format:
curl --request GET \
  --url https://desenvolvedores.skyhub.com.br/shipments/b2w/ \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-accountmanager-key: foo' \
  --header 'x-api-key: SuaAPIKey' \
  --header 'x-user-email: seu@email.com'
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["x-user-email"] = 'seu@email.com'
request["x-accountmanager-key"] = 'foo'
request["x-api-key"] = 'SuaAPIKey'

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

var options = {
  "method": "GET",
  "hostname": "desenvolvedores.skyhub.com.br",
  "port": null,
  "path": "/shipments/b2w/",
  "headers": {
    "accept": "application/json",
    "content-type": "application/json",
    "x-user-email": "seu@email.com",
    "x-accountmanager-key": "foo",
    "x-api-key": "SuaAPIKey"
  }
};

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.end();
import http.client

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

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'x-user-email': "seu@email.com",
    'x-accountmanager-key': "foo",
    'x-api-key': "SuaAPIKey"
    }

conn.request("GET", "/shipments/b2w/", headers=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/shipments/b2w/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json",
    "x-accountmanager-key: foo",
    "x-api-key: SuaAPIKey",
    "x-user-email: 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"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://desenvolvedores.skyhub.com.br/shipments/b2w/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")
	req.Header.Add("x-user-email", "seu@email.com")
	req.Header.Add("x-accountmanager-key", "foo")
	req.Header.Add("x-api-key", "SuaAPIKey")

	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 seu@email.com
x-accountmanager-key String Required

Identificador da sua integração com a SkyHub

foo
X-Api-Key String Required SuaAPIKey

Responses

200 Success Postagem (PLP) Get - listar plps
{
  plp: [
Array
    {
    { ... }
Object

Plp

      "id": "3442355",
String
      "expiration_date": "2017-11-26",
String
      orders: [
Array
        {
        { ... }
Object

Orders

          "code": "265358194401",
String
          "customer": "Francisca Da Silva",
String
          "value": 20.9
Number
        }
      ]
    }
  ]
}

Agrupar Pedidos em uma PLP

Open in API Explorer
POST /shipments/b2w/

Ao efetuar o POST para agrupar a PLP retornará a ID da PLP. Com a ID da PLP será necessário recuperar a PLP

Example Request

Format:
curl --request POST \
  --url https://desenvolvedores.skyhub.com.br/shipments/b2w/ \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-accountmanager-key: foo' \
  --header 'x-api-key: SuaApiKey' \
  --header 'x-user-email: seu@email.com' \
  --data '{"order_remote_codes":["265358194401","265358194401","265358194401"]}'
require 'uri'
require 'net/http'

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

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["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["x-user-email"] = 'seu@email.com'
request["x-api-key"] = 'SuaApiKey'
request["x-accountmanager-key"] = 'foo'
request.body = "{\"order_remote_codes\":[\"265358194401\",\"265358194401\",\"265358194401\"]}"

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

var options = {
  "method": "POST",
  "hostname": "desenvolvedores.skyhub.com.br",
  "port": null,
  "path": "/shipments/b2w/",
  "headers": {
    "accept": "application/json",
    "content-type": "application/json",
    "x-user-email": "seu@email.com",
    "x-api-key": "SuaApiKey",
    "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({ order_remote_codes: [ '265358194401', '265358194401', '265358194401' ] }));
req.end();
import http.client

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

payload = "{\"order_remote_codes\":[\"265358194401\",\"265358194401\",\"265358194401\"]}"

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'x-user-email': "seu@email.com",
    'x-api-key': "SuaApiKey",
    'x-accountmanager-key': "foo"
    }

conn.request("POST", "/shipments/b2w/", 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/shipments/b2w/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"order_remote_codes\":[\"265358194401\",\"265358194401\",\"265358194401\"]}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json",
    "x-accountmanager-key: foo",
    "x-api-key: SuaApiKey",
    "x-user-email: 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/shipments/b2w/"

	payload := strings.NewReader("{\"order_remote_codes\":[\"265358194401\",\"265358194401\",\"265358194401\"]}")

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

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")
	req.Header.Add("x-user-email", "seu@email.com")
	req.Header.Add("x-api-key", "SuaApiKey")
	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 seu@email.com
X-Api-Key String Required SuaApiKey
x-accountmanager-key String Required

Código identificador da sua integração

foo

Request Body

Name Type Required Description Example
order_remote_codes Object Required

//Lista de pedidos a serem agrupados

{
  "order_remote_codes": [
    "265358194401",
    "265358194401",
    "265358194401"
  ]
Array
}

Responses

200 Success Postagem (PLP) Post - retorno 200 agrupar pedidos plp
{
  "message": "Plp 14 agrupada com sucesso."
String
}

Desagrupar PLP

Open in API Explorer
DELETE /shipments/b2w/

Example Request

Format:
curl --request DELETE \
  --url https://desenvolvedores.skyhub.com.br/shipments/b2w/ \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-accountmanager-key: foo' \
  --header 'x-api-key: SuaApiKey' \
  --header 'x-user-email: seu@email.com'
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Delete.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request["x-user-email"] = 'seu@email.com'
request["x-api-key"] = 'SuaApiKey'
request["x-accountmanager-key"] = 'foo'

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

var options = {
  "method": "DELETE",
  "hostname": "desenvolvedores.skyhub.com.br",
  "port": null,
  "path": "/shipments/b2w/",
  "headers": {
    "content-type": "application/json",
    "accept": "application/json",
    "x-user-email": "seu@email.com",
    "x-api-key": "SuaApiKey",
    "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.end();
import http.client

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

headers = {
    'content-type': "application/json",
    'accept': "application/json",
    'x-user-email': "seu@email.com",
    'x-api-key': "SuaApiKey",
    'x-accountmanager-key': "foo"
    }

conn.request("DELETE", "/shipments/b2w/", headers=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/shipments/b2w/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json",
    "x-accountmanager-key: foo",
    "x-api-key: SuaApiKey",
    "x-user-email: 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"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://desenvolvedores.skyhub.com.br/shipments/b2w/"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "application/json")
	req.Header.Add("x-user-email", "seu@email.com")
	req.Header.Add("x-api-key", "SuaApiKey")
	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
Content-type String Required application/json
accept String Required application/json
X-User-Email String Required seu@email.com
X-Api-Key String Required SuaApiKey
x-accountmanager-key String Required

Código identificador da sua integração

foo

Request Body

Name Type Required Description Example
plp_id Object Required
{
  "plp_id": "14"
String
}

Responses

200 Success Postagem (PLP) Delete - retorno 200 desagrupar plp
{
  "message": "Plp 14 desagrupada com sucesso."
String
}

Recuperar PLP - PDF

Open in API Explorer
GET /shipments/b2w/view?plp_id={CODE}

Para recuperar a PLP é necessário primeiro eetuar o agrupamento da PLP para receber o ID e passar na Endpoint.

Caso queria retornar os dados da etiqueta em formato JSON, deve-se passar o header Accept: application/json .

Em caso de dúvida acesse nosso guia : https://skyhub.gelato.io/guides/servico-de-etiqueta-de-frete

Example Request

Format:
curl --request GET \
  --url 'https://desenvolvedores.skyhub.com.br/shipments/b2w/view?plp_id=%7BCODE%7D' \
  --header 'accept: application/pdf' \
  --header 'content-type: application/json' \
  --header 'x-accountmanager-key: foo' \
  --header 'x-api-key: SuaApiKey' \
  --header 'x-user-email: seu@email.com'
require 'uri'
require 'net/http'

url = URI("https://desenvolvedores.skyhub.com.br/shipments/b2w/view?plp_id=%7BCODE%7D")

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

request = Net::HTTP::Get.new(url)
request["x-accountmanager-key"] = 'foo'
request["x-api-key"] = 'SuaApiKey'
request["x-user-email"] = 'seu@email.com'
request["accept"] = 'application/pdf'
request["content-type"] = 'application/json'

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

var options = {
  "method": "GET",
  "hostname": "desenvolvedores.skyhub.com.br",
  "port": null,
  "path": "/shipments/b2w/view?plp_id=%7BCODE%7D",
  "headers": {
    "x-accountmanager-key": "foo",
    "x-api-key": "SuaApiKey",
    "x-user-email": "seu@email.com",
    "accept": "application/pdf",
    "content-type": "application/json"
  }
};

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.end();
import http.client

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

headers = {
    'x-accountmanager-key': "foo",
    'x-api-key': "SuaApiKey",
    'x-user-email': "seu@email.com",
    'accept': "application/pdf",
    'content-type': "application/json"
    }

conn.request("GET", "/shipments/b2w/view?plp_id=%7BCODE%7D", headers=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/shipments/b2w/view?plp_id=%7BCODE%7D",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/pdf",
    "content-type: application/json",
    "x-accountmanager-key: foo",
    "x-api-key: SuaApiKey",
    "x-user-email: 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"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://desenvolvedores.skyhub.com.br/shipments/b2w/view?plp_id=%7BCODE%7D"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-accountmanager-key", "foo")
	req.Header.Add("x-api-key", "SuaApiKey")
	req.Header.Add("x-user-email", "seu@email.com")
	req.Header.Add("accept", "application/pdf")
	req.Header.Add("content-type", "application/json")

	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
x-accountmanager-key String Required

Código identificador da sua integração

foo
x-api-key String Required SuaApiKey
x-user-email String Required seu@email.com
accept String Required application/pdf
content-type String Required application/json

Responses

200 Success Postagem (PLP) Get - retorno 200 recuperar a plp
{
  "Retorno": "Vem o PDF ou Json"
String
}

Lista de Pedidos Aptos ao Agrupamento

Open in API Explorer
GET /shipments/b2w/to_group

Atualmente é disponibilizado 20 pedidos por página via API, porém o mesmo pode realizar a paginação

Segue abaixo como realizar a paginação de pedidos aptos para agrupamento

https://api.skyhub.com.br/shipments/b2w/to_group?offset=1

O limite de pedidos para incluir no agrupamento atualmente é de 25

Example Request

Format:
curl --request GET \
  --url https://desenvolvedores.skyhub.com.br/shipments/b2w/to_group \
  --header 'accept: application/pdf' \
  --header 'x-accountmanager-key: foo' \
  --header 'x-api-key: SuaApiKey' \
  --header 'x-user-email: seu@email.com'
require 'uri'
require 'net/http'

url = URI("https://desenvolvedores.skyhub.com.br/shipments/b2w/to_group")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/pdf'
request["x-user-email"] = 'seu@email.com'
request["x-api-key"] = 'SuaApiKey'
request["x-accountmanager-key"] = 'foo'

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

var options = {
  "method": "GET",
  "hostname": "desenvolvedores.skyhub.com.br",
  "port": null,
  "path": "/shipments/b2w/to_group",
  "headers": {
    "accept": "application/pdf",
    "x-user-email": "seu@email.com",
    "x-api-key": "SuaApiKey",
    "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.end();
import http.client

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

headers = {
    'accept': "application/pdf",
    'x-user-email': "seu@email.com",
    'x-api-key': "SuaApiKey",
    'x-accountmanager-key': "foo"
    }

conn.request("GET", "/shipments/b2w/to_group", headers=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/shipments/b2w/to_group",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/pdf",
    "x-accountmanager-key: foo",
    "x-api-key: SuaApiKey",
    "x-user-email: 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"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://desenvolvedores.skyhub.com.br/shipments/b2w/to_group"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/pdf")
	req.Header.Add("x-user-email", "seu@email.com")
	req.Header.Add("x-api-key", "SuaApiKey")
	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/pdf
x-user-email String Required seu@email.com
x-api-key String Required SuaApiKey
x-accountmanager-key String Required

Código identificador da sua integração

foo

Responses

200 Success Postagem (PLP) Get - retorno 200 lista de pedidos aptos ao agrupamento
{
  orders: [
Array
    {
    { ... }
Object

Orders

      "code": "265358194401",
String
      "customer": "Francisca Da Silva",
String
      "value": 20.9
Number
    }
  ]
}