Software

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.