Create passes

The Gift to Wallet API uses API Keys for authentication that are tied to a specific user account.
Restrictions to your user account also apply to the API key which means that if you have only access to certain templates, you’ll obviously only see these templates, even if your Customer account contains more. The API Key needs to be passed in the Authorization HTTP Header (see below for details).

Best practice

We suggest to stick to a least privilege concept when creating API Keys. This means that if you are building an integration that should only have access to a certain pass-template, we suggest to create a service user (a separate login), that is restricted to just this template.
Create an API key for just that user instead of using one that has access to all data in your account.

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://veski.leikbreytir.is/api/pass/search/ab6427b6-26c9-4184-9e7b-7f2e4b2453ac/searchstring",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS =>"{\n\t\"pushNotificationText\": \"This comes from the API!\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: <your-api-key>",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;