API w/ Java
import static java.lang.System.out; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Response; public class IntelipostSample { public static void main(String[] args) { Client client = ClientBuilder.newClient(); Response res = client.target("https://api.intelipost.com.br/api/v1/quote_by_product").request().header("api-key", ...).post(Entity.json("{ \"origin_zip_code\": sampleOriginZipCode, \"destination_zip_code\": sampleDestinationZipCode, \"products\": [ { \"width\": sampleWidth, \"height\": sampleHeight, \"length\": sampleLength, \"weight\": sampleWeight } ] }")); if (res.getStatus() == 200) out.println(res.readEntity(String.class)); client.close(); } }
API w/ C#
using RestSharp; using System; public class IntelipostSample { public static void Main(string[] args) { var client = new RestClient("https://api.intelipost.com.br/api/v1"); var req = new RestRequest("quote_by_product", Method.POST); req.AddHeader("api-key", ...); req.AddParameter("application/json", @"{ ""origin_zip_code"": sampleOriginZipCode, ""destination_zip_code"": sampleDestinationZipCode, ""products"": [ { ""width"": sampleWidth, ""height"": sampleHeight, ""weight"": sampleWeight, ""length"": sampleLength } ] }", ParameterType.RequestBody); var res = client.Execute(req); if (res.IsSuccessful) Console.WriteLine(res.Content); } }
API w/ Go
package intelipostsample import "gopkg.in/resty.v1" import "fmt" func main() { res, _ := resty.R().SetHeader("api-key", ...).SetBody(`{ "origin_zip_code": sampleOriginZipCode, "destination_zip_code": sampleDestinationZipCode, "products": [ { "width": sampleWidth, "height": sampleHeight, "length": sampleLength, "weight": sampleWeight } ] }`).Post("https://api.intelipost.com.br/api/v1/quote_by_product") if res.StatusCode() == 200 { fmt.Printf("%v\n", res) } }
API w/ Node.js
var https = require('https'); var req = https.request({ headers: { 'api-key': ... }, hostname: 'api.intelipost.com.br', method: 'POST', path: '/api/v1/quote_by_product' }, (res) => { if (res.statusCode === 200) { var body = ''; res.on('data', (chunk) => { body += chunk.toString(); }); res.on('end', () => { console.log(body); }); } }); req.write('{ "origin_zip_code": sampleOriginZipCode, "destination_zip_code": sampleDestinationZipCode, "products": [ { "width": sampleWidth, "height": sampleHeight, "length": sampleLength, "weight": sampleWeight } ] }'); req.end();
API w/ PHP
<?php require 'vendor/autoload.php'; $client = new \GuzzleHttp\Client(); $res = $client->post('https://api.intelipost.com.br/api/v1/quote_by_product', [ 'headers' => [ 'api-key' => ... ], 'json' => [ 'origin_zip_code' => sampleOriginZipCode, 'destination_zip_code' => sampleDestinationZipCode, 'volumes' => [ [ 'width' => sampleWidth, 'height' => sampleHeight, 'weight' => sampleWeight, 'length' => sampleLength ] ] ] ]); if ($res->getStatusCode() == 200) echo $res->getBody();
API w/ Python
import requests res = requests.post('https://api.intelipost.com.br/api/v1/quote_by_product', headers = { 'api-key': ... }, json = { 'origin_zip_code': 'sampleOriginZipCode', 'destination_zip_code': 'sampleDestinationZipCode', 'products': [ { 'width': sampleWidth, 'height': sampleHeight, 'length': sampleLength, 'weight': sampleWeight } ] }) if res.ok: print res.text
API w/ Ruby
require 'rest-client' res = RestClient.post 'https://api.intelipost.com.br/api/v1/quote_by_product', '{ "origin_zip_code": sampleOriginZipCode, "destination_zip_code": sampleDestinationZipCode, "products": [ { "width": sampleWidth, "height": sampleHeight, "length": sampleLength, "weight": sampleWeight } ] }', :api_key => ... if res.code == 200 puts res.body end
API w/ VB.NET
Imports RestSharp Imports System Module Program Sub Main(args As String()) Dim client = New RestClient("https://api.intelipost.com.br/api/v1") Dim req = New RestRequest("quote_by_product", Method.POST) req.AddHeader("api-key", ...) req.AddParameter("application/json", "{ ""origin_zip_code"": sampleOriginZipCode, ""destination_zip_code"": sampleDestinationZipCode, ""products"": [ { ""width"": sampleWidth, ""height"": sampleHeight, ""weight"": sampleWeight, ""length"": sampleLength } ] }", ParameterType.RequestBody) Dim res = client.Execute(req) If (res.IsSuccessful) Then Console.WriteLine(res.Content) End If End Sub End Module
.NET SDK w/ C#
Not supported.
.NET SDK w/ VB.NET
Not supported.
Java SDK
Not supported.
PHP SDK
<?php require 'vendor/autoload.php'; $intelipost = new \Intelipost\Intelipost(); $proxy = $intelipost->GetCotacao(); $req = new \Intelipost\IntelipostModel\quote_by_product(); $req->origin_zip_code = sampleOriginZipCode; $req->destination_zip_code = sampleDestinationZipCode; $prod = new \Intelipost\IntelipostModel\product(); $prod->width = sampleWidth; $prod->height = sampleHeight; $prod->weight = sampleWeight; $prod->length = sampleLength; $req->AddProduct($prod); $res = $proxy->CriarCotacaoPorProduto($req); if ($res->isSuccess) var_dump($res->GetResult());
Ruby SDK
Not supported.