Learn about Account and Channels

On this page:

  • Learn about your account and how to access your channels via API

Step: Account, Authentication and Channel IDs

When you authenticate against our APIs, your requests are automatically associated with your account. Every call implicitly relates to your account credentials and you do not have to worry about the account details.

One or more channels are tied to your account and represent different shops, markets or business segments. Each channel has a unique ID. You can investigate the channels in your account via API call.

Step: Call the Channels API

To get the list of channels tied to your account, use the GET method against the eTrusted channels endpoint:

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.etrusted.com/channels/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer {access_token}",
    "Content-Type: application/json",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

The response looks like this:

[
    {
        "id": "chl-xxxxxxxa-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
        "createdAt": "2018-02-01T17:09:41.790Z",
        "updatedAt": "2018-02-01T17:09:41.790Z",
        "name": "my_example_channel",
        "address": "Anystr. 17, 12345, Anycity, Anystate 12345",
        "url": "https://wwww.myshop.fiction",
        "logoUrl": "https://wwww.myshop.fiction/logo.png",
        "accountRef": "acc-xxxxxxxa-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
        "locale": "en_US"
    }
]

Each object in the response list represents one of your channels. The id field is the channel's ID. Note that you also get your account's ID from the channel object: it is the accountRef field. Many further API calls expect a channel ID as a URL parameter. It is best to keep track of your channel IDs when working with the eTrusted APIs.