Skip to content

Commit

Permalink
Request parameterized stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Conor Flynn committed Feb 1, 2023
1 parent 5153294 commit ba7459f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.application.apihandler;

import java.util.HashMap;

import org.stream.external.requester.RequestParameterized;

public class SampleBlockchainAddresses {

public static void main(String[] args) {
HashMap<String, String> properties = new HashMap<String, String>();
HashMap<String, String> headers = new HashMap<String, String>();
HashMap<String, String> tags = new HashMap<String, String>();

properties.put("page", "0");
properties.put("size", "50");

headers.put("accept", "application/json");
headers.put("x-amberdata-blockchain-id", "ethereum-mainnet");
headers.put("x-api-key", "UAK7ed69235426c360be22bfc2bde1809b6");

tags.put("-rp", "page");
tags.put("-l", "50");

String[] path = {"payload", "records"};

RequestParameterized request = new RequestParameterized("test",
"https://web3api.io/api/v2/addresses", properties, headers, tags, path);

request.request(properties, headers);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ protected void process(HashMap<String, String> properties, HashMap<String, Strin
}

// send to specific request handler
process(response.body().toString(), properties, headers);
try {
String body = response.body().string().toString();
process(body, properties, headers);
} catch(Exception e) {
e.printStackTrace();
}
}

protected abstract void process(String json, HashMap<String, String> properties, HashMap<String, String> headers);
Expand Down
Binary file not shown.

0 comments on commit ba7459f

Please sign in to comment.