...
To connect to the Discovery API, form an HTTPS HTTP request and download the response file. You must keep the connection open while you are downloading the file. This may be different for every language or framework.
...
Code Block | ||
---|---|---|
| ||
Client: (Using HttpClient, Framework independent) String endpoint = " httpshttp://stream.api.citygridmedia.com/ads/budget/v2/discover?publisher=test&format=xml"; HttpGet httpGet = new HttpGet(endpoint); HttpClient client = new DefaultHttpClient(); HttpContext context = new BasicHttpContext(); HttpResponse getResponse = client.execute(httpGet, context); if (getResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { int size = -1; OutputStream os = new FileOutputStream("result.xml"); InputStream is = getResponse.getEntity().getContent(); byte[] buffer = new byte[4096]; while ((size = is.read(buffer)) != -1) { os.write(buffer, 0, size); } os.flush(); os.close(); client.getConnectionManager().shutdown(); } |
...
Obtaining Budget Available by Named Geographic Region
...
HTTPS Endpoint
The following endpoint is used with HTTP HTTPS GET:
Request Parameter
The following query string parameters are used with the Budget API endpoint:
...
Obtaining Budget Available by Latitude and Longitude
...
HTTPS Endpoint
The following endpoint is used with HTTP HTTPS GET:
Request Parameter
The following query string parameters are used with the Budget API endpoint:
...
Obtaining Budget Available by ID
...
HTTPS Endpoint
The following endpoint is used with HTTP HTTPS POST or GET:
Request Parameter
The following query string parameters are used with the Budget API endpoint:
...