コード例 #1
0
  static void printFeedForId(int feedId) {
    Pachube pachubeClient = new Pachube(API_KEY);

    try {
      Feed feed = pachubeClient.getFeed(feedId);

      HttpResponse data = pachubeClient.getDatastream(feed.getId(), 1);

      System.out.println(data.getBody());
    } catch (PachubeException e) {
      System.err.println(e.getMessage());
    }
  }
コード例 #2
0
  private static Feed addSeries(int feed, String friendlyName, double minValue, double maxValue)
      throws Exception {
    // Creates a Pachube object authenicated using the provided API KEY

    Pachube p = new Pachube(API_KEY);
    Feed f = p.getFeed(feed);
    Data a = new Data();
    a.setId(3);
    a.setMaxValue(maxValue);
    a.setMinValue(minValue);
    a.setTag(friendlyName);
    a.setValue(0);
    f.addData(a);
    Feed g = p.createFeed(f);

    // The Feed 'f' is does not represent the feed on pachube any
    // Changes made to this object will not alter the online feed.
    logger.debug("The id of the new feed is:");
    logger.debug(g.getId());

    return g;
  }