コード例 #1
0
 @Override
 public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
   super.prepare(stormConf, context, collector);
   String API_KEY = "DtobInc3mmZr4QasXReIpSbegOX1EEyywaJ3kNHXn44MULz7rC";
   this.resty = new Resty();
   resty.authenticate("https://push.ducksboard.com", API_KEY, new char[] {'x'});
   this.collector = collector;
 }
コード例 #2
0
ファイル: AddContact.java プロジェクト: terndrupm/Sendhub
  public static void main(String[] args) throws IOException {
    System.out.println("starting..");

    String contactsUrl =
        "https://" + SH_API_HOSTNAME + "/v1/contacts/?username="******"&api_key=" + API_KEY;

    Resty r = new Resty();

    String contact = "{\"name\":\"BBBBBdsfB\", \"number\": \"555556666\"}";

    // r.alwaysSend("Content-Type", "application/json");

    String resp =
        r.text(contactsUrl, new Content("application/json", contact.getBytes())).toString();

    System.out.println("result=" + resp);

    System.out.println("done.");
  }
コード例 #3
0
 protected void post(Map<?, ?> map) throws IOException {
   JSONObject someJson = new JSONObject(map);
   resty.json(url, content(someJson));
 }