{"id":2455,"date":"2020-09-25T11:57:03","date_gmt":"2020-09-25T11:57:03","guid":{"rendered":"https:\/\/support.itscope.hostpress.me\/?post_type=kb&#038;p=2455"},"modified":"2025-04-15T21:46:20","modified_gmt":"2025-04-15T19:46:20","slug":"authentication-via-api-credentials","status":"publish","type":"kb","link":"https:\/\/guide.itscope.com\/en\/kb\/authentication-via-api-credentials\/","title":{"rendered":"Authentication via API credentials"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">&nbsp;Authentication methods<\/h2>\n\n\n\n<p>There are three authentication methods to use the API:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Simple browser authentication &#8211; for exports, datasheets, image links, quick viewing in the browser etc.<\/li>\n\n\n\n<li>ITscope Authentication &#8211; requires an active browser session on https:\/www.itscope.com and should not be used programmatically. This method can e.g. be used for deep links from authorised participants to the platform.<\/li>\n\n\n\n<li>Programmatic Authentication via HTTP Basic Authentication &#8211; this is the standard authentication with username:password for the use of the ITscope API.<br>There are 2 different variants:\n<ul class=\"wp-block-list\">\n<li>Personal API access for individual use of the API. This variant is described in the section further down.<\/li>\n\n\n\n<li>Interface to ITscope for partner systems, which implement a connection for shared customers. Our interface partners receive the respective instructions during the implementation on request.<br>&nbsp;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3\">Personal ITscope API credentials<\/h2>\n\n\n\n<p>Personal login information for the ITscope API can be viewed in the own <a href=\"https:\/\/guide.itscope.com\/en\/kb\/employee-profile\/\" target=\"_blank\" rel=\"noreferrer noopener\">employee profile<\/a>.&nbsp;These are required for Username:Password HTTP Basic Authentication for the ITscope API.<\/p>\n\n\n\n<p>Following data is required:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Account ID &#8211; this is the username<\/strong><\/li>\n\n\n\n<li><strong>API Key &#8211; this is the password<\/strong><\/li>\n<\/ul>\n\n\n\n<p>This allows the ITscope API to be accessed.<\/p>\n\n\n\n<p>If you need a new API key, you can generate one with the <strong>New API Key<\/strong> button.&nbsp;Caution: this will invalidate the old key!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"661\" src=\"https:\/\/guide.itscope.com\/wp-content\/uploads\/2020\/09\/grafik-22.png\" alt=\"\" class=\"wp-image-18443\" srcset=\"https:\/\/guide.itscope.com\/wp-content\/uploads\/2020\/09\/grafik-22.png 814w, https:\/\/guide.itscope.com\/wp-content\/uploads\/2020\/09\/grafik-22-300x244.png 300w, https:\/\/guide.itscope.com\/wp-content\/uploads\/2020\/09\/grafik-22-768x624.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4\">Programmatic Authentication via HTTP Basic Authentication<\/h2>\n\n\n\n<p>For programmatic authentication in the <strong>development code<\/strong>, the API user (account ID) and the API password (API key) must be specified in the header, encoded as <strong>Base64<\/strong>. To do this, you can use a service like <a href=\"https:\/\/www.base64encode.org\">https:\/\/www.base64encode.org<\/a> and encode the Username:Password &#8216;&lt;Account-ID&gt;:&lt;API Key&gt;&#8217; string. The result of the encoding must then be inserted into the <strong>HTTP header Authorization:Basic<\/strong>. If the API URL is entered interactively into the browser, authentication is performed using the browser&#8217;s standard mechanisms for &#8216;Basic Auth&#8217;.<br><\/p>\n\n\n\n<p><strong>Example pseudo code for an API request:<\/strong><\/p>\n\n\n\n<p>Example pseudo code for a call via the API ITscope including <a href=\"https:\/\/guide.itscope.com\/en\/kb\/mandatory-user-agent-in-api-requests\/\">mandatory HTTP header user-agent<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">... \n\/\/ api url without credentials, e.g. \nstring apiurl = \"https:\/\/api.itscope.com\/2.1\/products\/search\/ean=0888462025737\/standard.xml\"; \nHttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiurl);\n\n\n\/\/ username:password Combination Base64 encoded \nstring credentials = &lt;Account-ID&gt;+ \":\" + &lt;API Key&gt; ;\nauthorization = Convert.ToBase64String(Encoding.Default.GetBytes(credentials)); \n\/\/ Basic Authorization as http header \nrequest.Headers[\"Authorization\"] = \"Basic \" + authorization;\n\n\n\/\/ useragent in the form &lt;applicationCompany&gt; - &lt;applicationName&gt; - &lt;applicationVersion&gt; \n\/\/ eg my company-my application-4.0927 \nrequest.UserAgent = \"MyCompany-My-Application-4.0927\" \n\n\/\/Others \nrequest.Method = \"GET\" \nrequest.KeepAlive = True \nrequest.ContentType = \"application\/xml\" \nrequest.AllowAutoRedirect = true \n... \n<\/pre>\n\n\n\n<p><strong>Examples of programmatic authentication<\/strong><\/p>\n\n\n\n<p>Example pseudo code for using&nbsp;<a href=\"https:\/\/guide.itscope.com\/en\/kb\/ready2go-api-clients-and-data-model-generation\/\">a generated C # client<\/a> directly from the Swagger Framework of the ITscope API including <a href=\"https:\/\/guide.itscope.com\/en\/kb\/mandatory-user-agent-in-api-requests\/\">mandatory HTTP header user-agent<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>...<\/code> \n<code>Configuration config = new Configuration(); \n \n<\/code>\/\/ username:password combination Base64 encoded \n<code>string credentials= ApiClient.Base64Encode(\"&lt;Account-ID&gt;:&lt;API Key&gt;\"); \n \n<\/code> \n\/\/ Basic Authorization as http header \n<code>config.AddDefaultHeader(\"Authorization\", \"Basic\" +<\/code> <code>credentials); \n <\/code> \n\/\/ useragent in the form &lt;applicationCompany&gt; - &lt;applicationName&gt; - &lt;applicationVersion&gt; \n\/\/ eg my company-my application-4.0927 \n<code>config.setUserAgent(\"MyCompany-MyApplication-4.0927\");\n \n\/\/ misc\nProductsApi pApi = new ProductsApi(config); <\/code>\n\n...<\/pre>\n\n\n\n<p><strong>Example pseudo code header for a PHP script:<\/strong><\/p>\n\n\n\n<p><code>....<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ username:password combination Base64 encoded \n\/\/ Basic Authorization as http header \nheader('Authorization: Basic '.<code>base64_encode(\"<\/code>&lt;Account ID&gt;:&lt;API Key&gt;\")<code>); \n<\/code> \n\n \/\/ useragent in the form &lt;applicationCompany&gt; - &lt;applicationName&gt; - &lt;applicationVersion&gt; \n \/\/ e.g. my company-my application-4.0927 \nheader('UserAgent:MyCompany-MyApplication-4.0927');\n<code>....<\/code><\/pre>\n\n\n\n<p><strong>Example pseudo code header for a PHP script with curl:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\n\/\/ username:password combination not Base64 encoded when the curl option CURLAUTH_BASIC is set,\n\/\/ then curl executes a Base64 encoding itself\n$UserPWD = \"&lt;Account ID&gt;:&lt;API Key&gt;\";\n\n$url = \"https:\/\/api.itscope.com\/2.1\/products\/search\/ean=<\/code>0888462025737<code>\/standard.xml\";\n$UserAgent = $_SERVER['HTTP_USER_AGENT'];\n&nbsp;&nbsp; &nbsp;\n$pptions = array (CURLOPT_URL =&gt; $url,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CURLOPT_HEADER =&gt; true,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CURLOPT_USERAGENT =&gt; $UserAgent,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CURLOPT_HTTPAUTH =&gt; CURLAUTH_BASIC,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CURLOPT_USERPWD =&gt; $UserPWD);\n$ch = curl_init();\ncurl_setopt_array($ch, $options);\n$Data = curl_exec($ch);\n....\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5\"><br>Simple browser authentication<\/h2>\n\n\n\n<p>The easiest way to call up the export via <strong>browser<\/strong>, <strong>wget<\/strong> or in <strong>Windows task planning<\/strong> etc. is to pass the authentication directly in the URL (the user must always have an entry in the Account ID field, see above!)<\/p>\n\n\n\n<p>Note: this method does not work in Internet Explorer.<\/p>\n\n\n\n<p><strong>An example of a retrieval in the browser for an export<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">https:\/\/&lt;Account-Id&gt;:&lt;API Key&gt;@api.itscope.com\/2.1\/products\/exports\/&lt;EXPORT-ID&gt;<\/pre>\n\n\n\n<p>If you do not enter the user name &lt;accountID&gt; or the password &lt;API key&gt; when retrieving the URL, authentication is performed via the standard mechanism of the browser for &#8216;Basic Auth&#8217; and you are prompted to enter the credentials in a separate window.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6\">ITscope authentication<\/h2>\n\n\n\n<p>This type of authentication is primarily intended for deeplinks into the platform and requires an active session on ITscope. If no active session exists, you will be directed to the login page. To do this, append the API URL with &#8216;itscope&#8217; for the &#8216;auth&#8217; query parameter.&nbsp;A call then looks as follows:<br><br><a href=\"https:\/\/api.itscope.com\/2.1\/products\/ean\/0886111583935\/deeplink.html?auth=itscope\">https:\/\/api.itscope.com\/2.1\/products\/ean\/0886111583935\/deeplink.html?auth=itscope<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;Authentication methods There are three authentication methods to use the API: Personal ITscope API credentials Personal login information for the ITscope API can be viewed in the own employee profile.&nbsp;These &#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[180],"kbtag":[],"class_list":["post-2455","kb","type-kb","status-publish","hentry","kbtopic-api-basics"],"_links":{"self":[{"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/kb\/2455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/comments?post=2455"}],"version-history":[{"count":6,"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/kb\/2455\/revisions"}],"predecessor-version":[{"id":18446,"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/kb\/2455\/revisions\/18446"}],"wp:attachment":[{"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/media?parent=2455"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/kbtopic?post=2455"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/guide.itscope.com\/en\/wp-json\/wp\/v2\/kbtag?post=2455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}