1 -module(hmac_api_client).
7 -include("hmac_api.hrl").
8 -author("Hypernumbers Ltd <gordon@hypernumbers.com>").
11 URL = "http://127.0.0.1:8080/some/page/yeah/",
12 %% Dates SHOULD conform to Section 3.3 of RFC2616
13 %% the examples from the RFC are:
14 %% Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
15 %% Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
16 %% Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
18 %% Dates can be conveniently generated using dh_date.erl
19 %% https://github.com/daleharvey/dh_date
20 %% which is largely compatible with
21 %% http://uk.php.net/date
23 %% You MIGHT find it convenient to insist on times in UTC only
24 %% as it reduces the errors caused by summer time and other
27 Headers = [{"content-type", "application/json"},
28 {"date", "Sun, 10 Jul 2011 05:07:19"}],
29 ContentType = "application/json",
31 HTTPAuthHeader = hmac_api_lib:sign(?privatekey, Method, URL,
32 Headers, ContentType),
33 httpc:request(Method, {URL, [HTTPAuthHeader | Headers],
34 ContentType, Body}, [], []).