{
  "info": {
    "name": "Trust Guard Reseller Seal API",
    "description": "Ready-to-paste Trust Guard seal codes for your clients' websites.\n\nBefore the first request, put your API key in the `apiKey` variable (Variables tab). Every setting and error is described in the Trust Guard Reseller Seal API document.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "key",
        "value": "X-API-Key",
        "type": "string"
      },
      {
        "key": "value",
        "value": "{{apiKey}}",
        "type": "string"
      },
      {
        "key": "in",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.trust-guard.com/api/seals.php",
      "type": "string"
    },
    {
      "key": "apiKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "did",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "List sites",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Sites listed', function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "const body = pm.response.json();",
              "const sites = body.data || [];",
              "",
              "// the first site's did, for \"Get seal code\" - put another site's did in the did variable to use that one",
              "if (sites.length && !pm.collectionVariables.get('did')) {",
              "    pm.collectionVariables.set('did', sites[0].did);",
              "}",
              "",
              "pm.visualizer.set(`",
              "<style>",
              "    body { font-family: sans-serif; font-size: 13px; }",
              "    table { border-collapse: collapse; }",
              "    th, td { border-bottom: 1px solid #ddd; padding: 4px 10px; text-align: left; }",
              "</style>",
              "{{#if errors}}",
              "    <p><b>HTTP {{status}}</b>: {{#each errors}}{{this}} {{/each}}</p>",
              "{{else}}",
              "    <p>{{sites.length}} sites</p>",
              "    <table>",
              "        <tr><th>url</th><th>company</th><th>frequency</th><th>did</th></tr>",
              "        {{#each sites}}<tr><td>{{url}}</td><td>{{company.name}}</td><td>{{frequency}}</td><td>{{did}}</td></tr>{{/each}}",
              "    </table>",
              "{{/if}}",
              "`, {sites: sites, errors: body.errors, status: body.status});"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/getapisealsites",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "getapisealsites"
          ]
        },
        "description": "The websites you can get seal codes for. When the `did` variable is empty, the first site's `did` is saved in it for **Get seal code**."
      }
    },
    {
      "name": "Get seal code",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Seal code returned', function () {",
              "    pm.response.to.have.status(200);",
              "    pm.expect(pm.response.json().data.html).to.be.a('string');",
              "});",
              "",
              "const body = pm.response.json();",
              "",
              "pm.visualizer.set(`",
              "<style>",
              "    body { font-family: sans-serif; font-size: 13px; }",
              "    .warning { background: #fff3cd; border: 1px solid #f0d58c; padding: 8px; }",
              "    textarea { width: 100%; height: 240px; font-family: monospace; font-size: 12px; }",
              "</style>",
              "{{#if errors}}",
              "    <p><b>HTTP {{status}}</b>: {{#each errors}}{{this}} {{/each}}</p>",
              "{{else}}",
              "    <p><b>{{seal.url}}</b>, {{seal.company.name}}</p>",
              "    {{#if seal.status.message}}<p class=\"warning\">{{seal.status.message}}</p>{{/if}}",
              "    <p><img src=\"{{seal.svgUrl}}\" alt=\"seal\" style=\"max-width: 100%;\"></p>",
              "    <p>Seal code (html):</p>",
              "    <textarea readonly>{{seal.html}}</textarea>",
              "    <p>Certificate: <a href=\"{{seal.certificateUrl}}\" target=\"_blank\">{{seal.certificateUrl}}</a></p>",
              "{{/if}}",
              "`, {seal: body.data, errors: body.errors, status: body.status});"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/getapisealcode?did={{did}}",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "getapisealcode"
          ],
          "query": [
            {
              "key": "did",
              "value": "{{did}}",
              "description": "The site's ID, from List sites."
            },
            {
              "key": "color",
              "value": "black",
              "description": "green (default), black or white",
              "disabled": true
            },
            {
              "key": "type",
              "value": "inner",
              "description": "outer (default) or inner. Ignored for checkout-banner.",
              "disabled": true
            },
            {
              "key": "placement",
              "value": "right",
              "description": "left (default), right, standalone or checkout-banner",
              "disabled": true
            },
            {
              "key": "dateformat",
              "value": "yyyy-mm-dd",
              "description": "dd-mm-yyyy (default), mm-dd-yyyy, yyyy-mm-dd, dd-mmm-yyyy, mmm-dd-yyyy or yyyy-mmm-dd",
              "disabled": true
            },
            {
              "key": "lang",
              "value": "nl",
              "description": "en (default), nl, de, fr, it, es or pt",
              "disabled": true
            },
            {
              "key": "address",
              "value": "office",
              "description": "The address the certificate shows: office or postal. Leave out for none.",
              "disabled": true
            },
            {
              "key": "phone",
              "value": "1",
              "description": "1 shows the client's support phone number on the certificate.",
              "disabled": true
            },
            {
              "key": "email",
              "value": "1",
              "description": "1 shows the client's support email address.",
              "disabled": true
            },
            {
              "key": "vat",
              "value": "1",
              "description": "1 shows the VAT number.",
              "disabled": true
            },
            {
              "key": "coc",
              "value": "1",
              "description": "1 shows the Chamber of Commerce number.",
              "disabled": true
            }
          ]
        },
        "description": "The seal code for the site in `did`. Tick settings on the Params tab to change the seal; each one's description lists its values. Switch the response body to **Visualize** to see the seal and copy its code."
      }
    }
  ]
}
