Setup API connection

Information required to setup connection

  • Operator access to Back-Office
  • API url
  • API client secret
  • API client id

Create API user through Back-Office

  1. Connect to Back-Office as operator

connect-bo

  1. Go to user menu

user_menu

  1. Create a user

create_user

  1. Add operator role to this user

user_add_operator_role

  1. Set the user password

user_set_password

Test your API user through Postman

You could test your api user through Postman by clicking here

postman_login

Use your access token to make your first request

The access token must be provided in each request that need authentication. It must be passed as Authorization header. A user can belongs to several user groups (operator / seller / customer), so you also must provide the context header that is the user group id who execute the request. If you're making the request as operator, you must set '1' for this parameter.

postman_login

PHP script example to setup API connection

Here is an example script on how to make request to Origami API with PHP and Guzzle

<?php

use GuzzleHttp\Client;

$access_token = '';
$base_url = '';
$client_id = 2;
$client_secret = 'secret';
$user_email = 'email';
$user_password = 'password';
$context = 1;

$headers = [
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
    'context' => $context
];

$params = [
    'client_id' => 2,
    'client_secret' => $client_id,
    'grant_type' => 'password',
    'username' => $user_email,
    'password' => $user_password
];

$client = new Client();
$response = $client->request('post', '/oauth/token', ['form_params' => $params, 'headers' => $headers]);
$headers['Authorization'] = 'Bearer '.json_decode($response->getBody()->getContents())->access_token;

$response = $client->request('get', '/v1/catalog/categories/1', ['headers' => $headers]);

You can find endpoints list by clicking here