{"id":44,"date":"2016-01-26T00:35:53","date_gmt":"2016-01-26T00:35:53","guid":{"rendered":"http:\/\/192.168.114.129\/?page_id=44"},"modified":"2023-06-24T11:09:28","modified_gmt":"2023-06-24T11:09:28","slug":"api-key-authentication","status":"publish","type":"page","link":"https:\/\/api-users.4over.com\/?page_id=44","title":{"rendered":"API Key Authentication"},"content":{"rendered":"<p>All requests are authenticated using an API-Key authentication method.<br \/>\nFor all GET and DELETE requests the api key and signature should be passed through the query string. For POST, PUT and PATCH requests &#8220;Authorize&#8221; or &#8220;Authorization&#8221; is passed through the header parameters, which is consisted of a public-key and a signature. The signature is generated from user&#8217;s private key using bellow algorithm.<br \/>\nEvery HTTP_METHOD will have different signature because the HMAC hash string used to generate the signature is the HTTP method type (GET, POST and etc).<\/p>\n<h3>GET and DELETE Requests<\/h3>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\nAuthentication for GET and DELETE requests\n\n?apikey={PUBLIC_KEY}&amp;signature={SIGNATURE}<\/pre>\n<h3>POST, PUT and PATCH Requests<\/h3>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\nRequest Header Parameters to authenticate POST, PUT and PATCH requests\n\nAuthorization: API {PUBLIC_KEY}:{SIGNATURE} <\/pre>\n<p>Where the signature is generated from a hash of user&#8217;s Private Key (see bellow for details on how to create the signatures)<\/p>\n<h3>How to create the Signature<\/h3>\n<p>PHP example &#8211; HMAC hash to generate signature<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">hash_hmac(\"sha256\", HTTP_METHOD, hash('sha256', $myPrivateKey));<\/pre>\n<p>Python Example &#8211; HMAC hash to generate signature<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\nprivate_key = hashlib.sha256({private_key}).hexdigest()\nsignature = hmac.new(private_key, HTTP_METHOD, hashlib.sha256).hexdigest()<\/pre>\n<p>In generating signatures do not use &#8220;HTTP_METHOD&#8221; string to generate HMAC hash. Depending on your request type, the appropriate HTTP_METHOD such as &#8220;GET&#8221;, &#8220;POST&#8221; and etc., should be used as the HMAC hash string to generate proper signature.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\n{html}\nAuthorize: API {PUBLIC_KEY}:{SIGNATURE}\n\n{html}\nAuthorization: API {PUBLIC_KEY}:{SIGNATURE}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>All requests are authenticated using an API-Key authentication method. For all GET and DELETE requests the api key and signature should be passed through the query string. For POST, PUT and PATCH requests &#8220;Authorize&#8221; or &#8220;Authorization&#8221; is passed through the header parameters, which is consisted of a public-key and a signature. The signature is generated [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":39,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-44","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":4,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages\/44\/revisions"}],"predecessor-version":[{"id":603,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages\/44\/revisions\/603"}],"up":[{"embeddable":true,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages\/39"}],"wp:attachment":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}