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

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

    final 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

const https = require('https');

const 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
Advertisements

How to List Projects 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 final class RunrunitSample {

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

    final Response res = client.target("https://secure.runrun.it/api/v1.0/projects").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")

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

}

Node.js

const https = require('https');

const req = https.get({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', path: '/api/v1.0/projects' }, (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', 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', :app_key => ..., :user_token => ...

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

How to Create 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 final class RunrunitSample {

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

    client.target("https://secure.runrun.it/api/v1.0/projects").request().header("App-Key", ...).header("User-Token", ...).post(Entity.json("{ \"project\": { \"name\": \"SampleProject\", \"client_id\": sampleClient } }"));

    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": "SampleProject", "client_id": sampleClient } }`).Post("https://secure.runrun.it/api/v1.0/projects")
}

Node.js

const https = require('https');

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

req.write('{ "project": { "name": "SampleProject", "client_id": sampleClient } }');

req.end();

Python

import requests

requests.post('https://secure.runrun.it/api/v1.0/projects', headers = { 'App-Key': ..., 'User-Token': ... }, json = { 'project': { 'name': 'SampleProject', 'client_id': sampleClient } })

Ruby

require 'rest-client'

RestClient.post 'https://secure.runrun.it/api/v1.0/projects', { project: { name: 'SampleProject', client_id: sampleClient} }, :app_key => ..., :user_token => ...

How to Update a Client in Runrun.it

Java

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

public final class RunrunitSample {

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

    client.target("https://secure.runrun.it/api/v1.0/clients/699762").request().header("App-Key", ...).header("User-Token", ...).put(Entity.json("{ \"client\": { \"name\": \"SampleClient2\" } }"));

    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(`{ "client": { "name": "SampleClient2" } }`).Put("https://secure.runrun.it/api/v1.0/clients/sampleClient")
}

Node.js

const https = require('https');

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

req.write('{ "client": { "name": "SampleClient2" } }');

req.end();

Python

import requests

requests.put('https://secure.runrun.it/api/v1.0/clients/sampleClient', headers = { 'App-Key': ..., 'User-Token': ... }, json = { 'client': { 'name': 'SampleClient2' } })

Ruby

require 'rest-client'

RestClient.put 'https://secure.runrun.it/api/v1.0/clients/sampleClient', { client: { name: 'SampleClient2' } }, :app_key => ..., :user_token => ...

How to Retrieve a Client 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 final class RunrunitSample {

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

    final Response res = client.target("https://secure.runrun.it/api/v1.0/clients/sampleClient").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/clients/sampleClient")

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

}

Node.js

const https = require('https');

const req = https.get({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', path: '/api/v1.0/clients/sampleClient' }, (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/clients/sampleClient', 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/clients/sampleClient', :app_key => ..., :user_token => ...

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

How to List Clients 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 final class RunrunitSample {

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

    final Response res = client.target("https://secure.runrun.it/api/v1.0/clients").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/clients")

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

}

Node.js

const https = require('https');

const req = https.get({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', path: '/api/v1.0/clients' }, (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/clients', 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/clients', :app_key => ..., :user_token => ...

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

How to Create a Client in Runrun.it

Java

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

public final class RunrunitSample {

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

    client.target("https://secure.runrun.it/api/v1.0/clients").request().header("App-Key", ...).header("User-Token", ...).post(Entity.json("{ \"client\": { \"name\": \"SampleClient\" } }"));

    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(`{ "client": { "name": "SampleClient" } }`).Post("https://secure.runrun.it/api/v1.0/clients")
}

Node.js

const https = require('https');

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

req.write('{ "client": { "name": "SampleClient" } }');

req.end();

Python

import requests

requests.post('https://secure.runrun.it/api/v1.0/clients', headers = { 'App-Key': ..., 'User-Token': ... }, json = { 'client': { 'name': 'SampleClient' } })

Ruby

require 'rest-client'

RestClient.post 'https://secure.runrun.it/api/v1.0/clients', { client: { name: 'SampleClient' } }, :app_key => ..., :user_token => ...

How to Delete a Team in Runrun.it

Java

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

public final class RunrunitSample {

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

    client.target("https://secure.runrun.it/api/v1.0/teams/sampleTeam").request().header("App-Key", ...).header("User-Token", ...).delete();

    client.close();
  }

}

Go

package runrunitsample

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("App-Key", ...).SetHeader("User-Token", ...).Delete("https://secure.runrun.it/api/v1.0/teams/sampleTeam")
}

Node.js

const https = require('https');

const req = https.request({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', method: 'DELETE', path: '/api/v1.0/teams/sampleTeam' });

req.end();

Python

import requests
 
requests.delete('https://secure.runrun.it/api/v1.0/teams/sampleTeam', headers = { 'App-Key': ..., 'User-Token': ... })

Ruby

require 'rest-client'

RestClient.delete 'https://secure.runrun.it/api/v1.0/teams/sampleTeam', :app_key => ..., :user_token => ...

How to Update a Team 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 final class RunrunitSample {

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

    final Response res = client.target("https://secure.runrun.it/api/v1.0/teams/sampleTeam").request().header("App-Key", ...).header("User-Token", ...).put(Entity.json("{ \"team\": { \"name\": \"SampleTeam2\" } }"));

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

    client.close();
  }

}

Go

package main

import "gopkg.in/resty.v1"

func main() {
  resty.R().SetHeader("Content-Type", "application/json").SetHeader("App-Key", ...).SetHeader("User-Token", ...).SetBody(`{ "team": { "name": "SampleTeam2" } }`).Put("https://secure.runrun.it/api/v1.0/teams/sampleTeam")
}

Node.js

const https = require('https');

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

req.write('{ "team": { "name": "SampleTeam2" } }');

req.end();

Python

import requests
 
requests.put('https://secure.runrun.it/api/v1.0/teams/sampleTeam', headers = { 'App-Key': ..., 'User-Token': ... }, json = { 'team': { 'name': 'SampleTeam2' } })

Ruby

require 'rest-client'

RestClient.put 'https://secure.runrun.it/api/v1.0/teams/sampleTeam', { team: { name: 'SampleTeam2' } }, :app_key => ..., :user_token => ...

How to Retrieve a Team 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 final class RunrunitSample {

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

    final Response res = client.target("https://secure.runrun.it/api/v1.0/teams/sampleTeam").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/teams/sampleTeam")

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

}

Node.js

const https = require('https');

const req = https.get({ headers: { 'app-key': ..., 'user-token': ... }, hostname: 'secure.runrun.it', path: '/api/v1.0/teams/sampleTeam' }, (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/teams/sampleTeam', 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/teams/sampleTeam', :app_key => ..., :user_token => ...

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