2

More specifically, I am looking at the Web Services of Commission Junction (http://help.cj.com/en/web_services/web_services.htm#Commission_Detail_Service.htm) and the Authorization key is supposed to be part of the "Header" for the request.

Would I be able to send the request with just a url? For example (using the URI from their website): https://publisher-lookup.api.cj.com/v2/joined-publisher-lookup?Authorization=[developer key]&url=http%3A%2F%2Fwww.cj.com

Also, if anybody is familiar with Pentaho Data Integration v4.3 (PDI or Kettle), help with making this API call using PDI would be much appreciated (that is ultimately what I am trying to achieve).

Thank you!

Marina
  • 3,222
  • 5
  • 25
  • 35
  • Why don't you want to put it in the request header but in the URL? – Otto Allmendinger Jul 06 '12 at 13:17
  • I am using a data integration tool, Pentaho Data Integration, and I thought that the transformation step for making a REST call does not have fields available for headers. I have just discovered that it does. However, I am still interested to know if it is possible to send the REST request just through a url. – Marina Jul 06 '12 at 13:29
  • 2
    It depends on the server implementation, you could try passing it as a query parameter. However I doubt that it works, the `Authorization` field is a standard HTTP header field and processed differently than query parameters. – Otto Allmendinger Jul 06 '12 at 16:53

3 Answers3

4

For Firefox, there is an add-on to make a REST API call with headers: https://addons.mozilla.org/en-US/firefox/addon/modify-headers/

And Commission Junction outlines how to use it: http://www.cj.com/webservices/quick-start-guide

Marina
  • 3,222
  • 5
  • 25
  • 35
0

This depends 100% on commission junction since they'll be expecting the key in one place or another. They may have allowed for the means to pass it in the URL or not but it's implementation on their side which determines this and should be in their docs. Is doesn't invalidate the REST pattern per-se.

Sounds like you found out how to pass the params in the header anyway - so that's probably the way to go.

steve
  • 1,978
  • 13
  • 23
0

you should send the developer key as http header. Here is an example code for commissionjunction (CJ) in PHP:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://commission-detail.api.cj.com/v3/commissions?date-type=posting&start-date=" . date('Y-m-d', (time()-(24*3600))) . "&end-date=" . date('Y-m-d'));
curl_setopt($ch, CURLOPT_HEADER, false); 
curl_setopt($ch, CURLOPT_GET, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("authorization: " . $yourdeveloperkey));
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
Bo Pennings
  • 945
  • 1
  • 10
  • 20