How to Create a Quote by Product in Intelipost

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.

Advertisements

How to Create a Quote by Volume in Intelipost

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").request().header("api-key", ...).post(Entity.json("{ \"origin_zip_code\": sampleOriginZipCode, \"destination_zip_code\": sampleDestinationZipCode, \"volumes\":  [ { \"width\": sampleWidth, \"height\": sampleHeight, \"length\": sampleLength, \"weight\": sampleWeight, \"volume_type\": sampleVolumeType } ] }"));

    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", Method.POST);

    req.AddHeader("api-key", ...);

    req.AddParameter("application/json", @"{ ""origin_zip_code"": sampleOriginZipCode, ""destination_zip_code"": sampleDestinationZipCode, ""volumes"":  [ { ""width"": sampleWidth, ""height"": sampleHeight, ""weight"": sampleWeight, ""length"": sampleLength, ""volume_type"": sampleVolumeType } ] }", 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, "volumes":  [ { "width": sampleWidth, "height": sampleHeight, "length": sampleLength, "weight": sampleWeight", "volume_type": sampleVolumeType } ] }`).Post("https://api.intelipost.com.br/api/v1/quote")

  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' }, (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, "volumes":  [ { "width": sampleWidth, "height": sampleHeight, "weight": sampleWeight, "length": sampleLength, "volume_type": sampleVolumeType } ] }');

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', [ 'headers' => [ 'api-key' => ... ], 'json' => [ 'origin_zip_code' => sampleOriginZipCode, 'destination_zip_code' => sampleDestinationZipCode, 'volumes' =>  [ [ 'width' => sampleWidth, 'height' => sampleHeight, 'weight' => sampleWeight, 'length' => sampleLength, 'volume_type' => sampleVolumeType ] ] ] ]);

if ($res->getStatusCode() == 200)
  echo $res->getBody();

API w/ Python

import requests

res = requests.post('https://api.intelipost.com.br/api/v1/quote', headers = { 'api-key': ... }, json = { 'origin_zip_code': sampleOriginZipCode,'destination_zip_code': sampleDestinationZipCode, 'volumes':  [ { 'width': sampleWidth, 'height': sampleHeight, 'length': sampleLength, 'weight': sampleWeight', 'volume_type': sampleVolumeType } ] })

if res.ok:
  print res.text

API w/ Ruby

require 'rest-client'

res = RestClient.post 'https://api.intelipost.com.br/api/v1/quote', '{ "origin_zip_code": sampleOriginZipCode, "destination_zip_code": sampleDestinationZipCode, "volumes":  [ { "width": sampleWidth, "height": sampleHeight, "length": sampleLength, "weight": sampleWeight, "volume_type": sampleVolumeType } ] }', :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", Method.POST)

    req.AddHeader("api-key", ...)

    req.AddParameter("application/json", "{ ""origin_zip_code"": sampleOriginZipCode, ""destination_zip_code"": sampleDestinationZipCode, ""volumes"":  [ { ""width"": sampleWidth, ""height"": sampleHeight, ""weight"": sampleWeight, ""length"": sampleLength, ""volumeType"": sampleVolumeType } ] }", 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#

using Intelipost.API;
using Intelipost.API.Model;
using Intelipost.API.Utilities;

using System.Collections.Generic;

public class IntelipostSample
{

  public static void Main(string[] args)
  {
    var req = new Request<Intelipost.API.Model.Quote>()
    {
      Content = new Intelipost.API.Model.Quote()
      {
        OriginZipCode = sampleOriginZipCode,
        DestinationZipCode = sampleDestinationZipCode,
        Volumes = new List<Volume>()
        {
          new Volume()
          {
            Width = sampleWidth,
            Height = sampleHeight,
            Length = sampleLength,
            Weight = sampleWeight,
            VolumeType = sampleVolumeType
          }
        }
      }
    };

    var config = new Configure();
    
    config.Initialize(..., false, "");

    var proxy = new Intelipost.API.Quote();

    var res = proxy.RequestNewQuote(req);

    if (res.Status == "OK")
      Console.WriteLine(res);

  }

}

.NET SDK w/ VB.NET

Imports Intelipost.API
Imports Intelipost.API.Model
Imports Intelipost.API.Utilities

Module IntelipostSample

  Sub Main(args As String())
    Dim Req = New Request(Of Intelipost.API.Model.Quote) With {
      .Content = New Intelipost.API.Model.Quote With {
        .OriginZipCode = SampleOriginZipCode,
        .DestinationZipCode = SampleDestinationZipCode,
        .Volumes = New List(Of Volume) From {
          New Volume With {
            .Width = SampleWidth,
            .Height = SampleHeight,
            .Length = SampleLength,
            .Weight = SampleWeight,
            .VolumeType = SampleVolumeType
          }
        }
      }
    }

    Dim Config = New Configure

    Config.Initialize(..., False, "")

    Dim Proxy = New Intelipost.API.Quote

    Dim Res = Proxy.RequestNewQuote(Req)

    If Res.Status = "OK" Then
      Console.WriteLine(Res)
    End If

  End Sub

End Module

Java SDK

import static java.lang.System.out;

import java.util.ArrayList;
import java.util.List;

import infrastructure.Request;
import model.Quote;
import model.QuoteVolume;

public class IntelipostSample {

  public static void main(String[] args) throws Exception {
    List<QuoteVolume> volumes = new ArrayList<QuoteVolume>();

    QuoteVolume volume = new QuoteVolume();

    volume.setWidth(sampleWidth);

    volume.setHeight(sampleHeight);

    volume.setLength(sampleLength);

    volume.setWeight(sampleWeight);

    volume.setVolumeType(sampleVolumeType);

    volumes.add(volume);

    Quote quote = new Quote(sampleOriginZipCode, sampleDestinationZipCode, volumes);

    Request req = new Request("https://api.intelipost.com.br/api/v1/quote", ..., quote);

    out.println(req.doPostRequest());
  }

}

PHP SDK

<?php
require 'vendor/autoload.php';

$intelipost = new \Intelipost\Intelipost();

$proxy = $intelipost->GetCotacao();

$req = new \Intelipost\IntelipostModel\quote();

$req->origin_zip_code = sampleOriginZipCode;

$req->destination_zip_code = sampleDestinationZipCode;

$vol = new \Intelipost\IntelipostModel\volume();

$vol->width = sampleWidth;

$vol->height = sampleHeight;

$vol->weight = sampleWeight;

$vol->length = sampleLength;

$vol->volume_type = sampleVolumeType;

$req->AddVolume($vol);

$res = $proxy->CriarCotacaoPorVolume($req);

if ($res->isSuccess)
  var_dump($res->GetResult());

Ruby SDK

require 'intelipost'

client = Intelipost::Client.new api_key: ...

quote = client.quote.create({ 'origin_zip_code' => sampleOriginZipCode, 'destination_zip_code' => sampleDestinationZipCode, 'volumes' =>  [ { 'width' => sampleWidth, 'height' => sampleHeight, 'length' => sampleLength, 'weight' => sampleWeight, 'volume_type' => sampleVolumeType } ] })

puts quote

How to Close a Task in Runrun.it

Java

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;

public class RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.target("https://secure.runrun.it/api/v1.0/tasks/sampleTask/close").request().header("App-Key", ...).header("User-Token", ...).post(Entity.json(""));
    
    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("Content-Type", "application/json").SetHeader("App-Key", ...).SetHeader("User-Token", ...).Post("https://secure.runrun.it/api/v1.0/tasks/sampleTask/close")
}

Node.js

var https = require('https');

var req = https.post({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', method: 'POST', path: '/api/v1.0/tasks/sampleTask/close' });

req.end();

Python

import requests

requests.post('https://secure.runrun.it/api/v1.0/tasks/sampleTask/close', headers = { 'App-Key': ..., 'User-Token': ... })

Ruby

require 'rest-client'

RestClient.post 'https://secure.runrun.it/api/v1.0/tasks/sampleTask/close', :app_key => ..., :user_token => ...

How to Pause a Task in Runrun.it

Java

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;

public class RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.target("https://secure.runrun.it/api/v1.0/tasks/sampleTask/pause").request().header("App-Key", ...).header("User-Token", ...).post(Entity.json(""));
    
    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("Content-Type", "application/json").SetHeader("App-Key", ...).SetHeader("User-Token", ...).Post("https://secure.runrun.it/api/v1.0/tasks/sampleTask/pause")
}

Node.js

var https = require('https');

var req = https.post({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', method: 'POST', path: '/api/v1.0/tasks/sampleTask/pause' });

req.end();

Python

import requests

requests.post('https://secure.runrun.it/api/v1.0/tasks/sampleTask/pause', headers = { 'App-Key': ..., 'User-Token': ... })

Ruby

require 'rest-client'

RestClient.post 'https://secure.runrun.it/api/v1.0/tasks/sampleTask/pause', :app_key => ..., :user_token => ...

How to Play a Task in Runrun.it

Java

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;

public class RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.target("https://secure.runrun.it/api/v1.0/tasks/sampleTask/play").request().header("App-Key", ...).header("User-Token", ...).post(Entity.json(""));
    
    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("Content-Type", "application/json").SetHeader("App-Key", ...).SetHeader("User-Token", ...).Post("https://secure.runrun.it/api/v1.0/tasks/sampleTask/play")
}

Node.js

var https = require('https');

var req = https.post({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', method: 'POST', path: '/api/v1.0/tasks/sampleTask/play' });

req.end();

Python

import requests

requests.post('https://secure.runrun.it/api/v1.0/tasks/sampleTask/play', headers = { 'App-Key': ..., 'User-Token': ... })

Ruby

require 'rest-client'

RestClient.post 'https://secure.runrun.it/api/v1.0/tasks/sampleTask/play', :app_key => ..., :user_token => ...

How to Retrieve a Task in Runrun.it

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 RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    Response res = client.target("https://secure.runrun.it/api/v1.0/tasks/sampleTask").request().header("App-Key", ...).header("User-Token", ...).get();

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

import "fmt"

func main() {
  res, _ := resty.R().SetHeader("App-Key", ...).SetHeader("User-Token", ...).Get("https://secure.runrun.it/api/v1.0/tasks/sampleTask")

  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }

}

Node.js

var https = require('https');

var req = https.get({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', path: '/api/v1.0/tasks/sampleTask' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';
 
    res.on('data', (chunk) => {
      body += chunk.toString();
    });
 
    res.on('end', () => {
      console.log(body);
    });
 
  }

});

req.end();

Python

import requests

res = requests.post('https://secure.runrun.it/api/v1.0/tasks/sampleTask', headers = { 'App-Key': ..., 'User-Token': ... })

if res.ok:
  print res.text

Ruby

require 'rest-client'

res = RestClient.get 'https://secure.runrun.it/api/v1.0/tasks/sampleTask', :app_key => ..., :user_token => ...

if res.code == 200
  puts res.body
end

How to List Tasks in Runrun.it

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 RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    Response res = client.target("https://secure.runrun.it/api/v1.0/tasks").request().header("App-Key", ...).header("User-Token", ...).get();

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

import "fmt"

func main() {
  res, _ := resty.R().SetHeader("App-Key", ...).SetHeader("User-Token", ...).Get("https://secure.runrun.it/api/v1.0/tasks")

  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }

}

Node.js

var https = require('https');

var req = https.get({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', path: '/api/v1.0/tasks' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';
 
    res.on('data', (chunk) => {
      body += chunk.toString();
    });
 
    res.on('end', () => {
      console.log(body);
    });
 
  }

});

req.end();

Python

import requests

res = requests.get('https://secure.runrun.it/api/v1.0/tasks', headers = { 'App-Key': ..., 'User-Token': ... }, )

if res.ok:
  print res.text

Ruby

require 'rest-client'

res = RestClient.get 'https://secure.runrun.it/api/v1.0/tasks', :app_key => ..., :user_token => ...

if res.code == 200
  puts res.body
end

How to Create a Task in Runrun.it

Java

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;

public class RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.target("https://secure.runrun.it/api/v1.0/tasks").request().header("App-Key", ...).header("User-Token", ...).post(Entity.json("{ \"task\": { \"project_id\": sampleProject, \"responsible_id\": sampleUser, \"title\": \"Sample Task\", \"type_id\": sampleType } }"));

    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("Content-Type", "application/json").SetHeader("App-Key", ...).SetHeader("User-Token", ...).SetBody(`{ "task": { "project_id": sampleProject, "responsible_id": sampleUser, "title": "Sample Task", "type_id": sampleType } }`).Post("https://secure.runrun.it/api/v1.0/tasks")
}

Node.js

var https = require('https');

var req = https.request({ headers: { 'content-type': 'application/json', 'content-length': ..., 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', method: 'POST', path: '/api/v1.0/tasks' });

req.write('{ "task": { "project_id": sampleProject, "responsible_id": sampleUser, "title": "Sample Task", "type_id": sampleType } }');

req.end();

Python

import requests

requests.post('https://secure.runrun.it/api/v1.0/tasks', headers = { 'App-Key': ..., 'User-Token': ... }, json = { 'task': { 'project_id': sampleProject, 'responsible_id': sampleUser, 'title': 'Sample Task', 'type_id': sampleType } })

Ruby

require 'rest-client'

RestClient.post 'https://secure.runrun.it/api/v1.0/tasks', { task: { project_id: sampleProject, responsible_id: sampleUser, title: 'Sample Task', type_id: sampleType } }, :app_key => ..., :user_token => ...

How to Update a Project in Runrun.it

Java

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;

public class RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.target("https://secure.runrun.it/api/v1.0/projects/sampleProject").request().header("App-Key", ...).header("User-Token", ...).put(Entity.json("{ \"project\": { \"name\": \"Sample Project 2\" } }"));

    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("Content-Type", "application/json").SetHeader("App-Key", ...).SetHeader("User-Token", ...).SetBody(`{ "project": { "name": "Sample Project 2" }`).Put("https://secure.runrun.it/api/v1.0/projects/sampleProject")
}

Node.js

var https = require('https');

var req = https.request({ headers: { 'content-type': 'application/json', 'content-length': ..., 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', method: 'PUT', path: '/api/v1.0/projects/sampleProject' });

req.write('{ "project": { "name": "Sample Project 2" } }');

req.end();

Python

import requests

requests.put('https://secure.runrun.it/api/v1.0/projects/sampleProject', headers = { 'App-Key': ..., 'User-Token': ..., json = { 'project': { 'name': 'Sample Project 2' } } })

Ruby

require 'rest-client'

RestClient.put 'https://secure.runrun.it/api/v1.0/projects/sampleProject', { project: { name: 'Sample Project 2' } }, :app_key => ..., :user_token => ...

How to Retrieve a Project in Runrun.it

Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;

public class RunrunitSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    Response res = client.target("https://secure.runrun.it/api/v1.0/projects/sampleProject").request().header("App-Key", ...).header("User-Token", ...).get();

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

import "fmt"

func main() {
  res, _ := resty.R().SetHeader("App-Key", ...).SetHeader("User-Token", ...).Get("https://secure.runrun.it/api/v1.0/projects/sampleProject")

  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }

}

Node.js

var https = require('https');

var req = https.get({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', path: '/api/v1.0/projects/sampleProject' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';
 
    res.on('data', (chunk) => {
      body += chunk.toString();
    });
 
    res.on('end', () => {
      console.log(body);
    });
 
  }

});

req.end();

Python

import requests

res = requests.get('https://secure.runrun.it/api/v1.0/projects/sampleProject', headers = { 'App-Key': ..., 'User-Token': ... })

if res.ok:
  print res.text

Ruby

require 'rest-client'

res = RestClient.get 'https://secure.runrun.it/api/v1.0/projects/sampleProject', :app_key => ..., :user_token => ...

if res.code == 200
  puts res.body
end