Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

A row import example with the Guzzle client in PHP.

$client = new GuzzleHttp\Client([
    'base_uri' => 'http://reminders-staging.alphacommapi.com/v1'
]);

$query = <<<'QUERY'
mutation addRecords (
  $file: FileInput,
  $rows: [RowInput!]
) {
  import {
    addRecords(file: $file, rows: $rows) {
      name
      action
      status
      records {
        scriptId
        status
        messages {
          context
          message
          level
        }
      }
    }
  }
}
QUERY;

$variables = [
    'rows' => [
        'reference' => 'f0e7a0c3',
        'script' => '<script id>',
        'personFamilyName' => 'Alphacomm',
        'toMailAddress' => 'reminders@alphacomm.nl',
        'invoiceDescription' => 'Example payment',
        'invoiceDate' => '2019-04-04',
        'invoiceDueDate' => '2019-07-30',
        'invoiceReference' => '40824524',
        'invoiceCurrency' => 'EUR',
        'invoiceAmount' => '56445',
        'invoiceNumber' => '249075245',
        'personBirthDay' => '2000-01-01'
    ]
];

$response = $client->request('POST', '', [
    'json' => [
        'query' => $query,
        'variables' => $variables,
    ],
    'headers' => ['X-AUTH-TOKEN' => '<TOKEN FROM PORTAL>'],
]);

  • No labels