Miss any of our Open RFC calls?Watch the recordings here! »

@particular./zendesk-magento-m1-request

1.1.1 • Public • Published

@particular./zendesk-magento-m1-request

npm version semantic-release code style: prettier CircleCI dependency status: david

🎮 Minimal Magento m1 API request library for Node (design for use w/ Zendesk Extension)

Installation

yarn add @particular./zendesk-magento-m1-request # npm install @particular./zendesk-magento-m1-request 

Quickstart (OAuth)

const { createClient } = require('@particular./zendesk-magento-m1-request');
// import { createClient } from '@particular./zendesk-magento-m1-request'
 
const magentoM1 = new createClient({
  store_url: 'https://.../...', //Magento m1 Store URL
  access_token: '...' //Access token generated after installing/configuring Zendesk extension
});
 
magentoM1
  .get(`zendesk/api/customers/${email}`)
  .then(console.log)
  .catch(console.error);

Custom headers per request

The API provides you the ability to send various request headers that change the way data is stored or retrieved.

By default this library will encode all data as JSON, however you can customise this by setting your own Content-Type header as an additional argument to get, patch, post, put and delete.

Note: If you add the Content-Type custom header to patch, post, put or delete you will need to encode data yourself.

const magentoM1 = new createClient({
  store_url: 'https://.../...', //Magento m1 Store URL
  access_token: '...' //Access token generated after installing/configuring Zendesk extension
});
 
const headers = {
  'X-My-Header': 'custom'
};
 
magentoM1
  .get(`zendesk/api/customers/${email}`, headers)
  .then(console.log)
  .catch(console.error);

Contact Adam Grohs @ Particular. for any questions.

Install

npm i @particular./zendesk-magento-m1-request

DownloadsWeekly Downloads

141

Version

1.1.1

License

MIT

Unpacked Size

19.3 kB

Total Files

18

Last publish

Collaborators

  • avatar