1.0.1 • Published 2 years ago

@phoenixdev/pretix-rest-api v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Pretix API - Node.js Client

A Node.js client for the Pretix REST API. Easily interact with the Pretix REST API using this library.

Installation

npm install @phoenixdev/pretix-rest-api
yarn add @phoenixdev/pretix-rest-api

Getting started

GET API credentials from youe dealer .

Pretix Services reference https://docs.pretix.eu/en/latest/api/index.html.

Setup

Setup for the REST API integration :

const PretixRestApi = require('@phoenixdev/pretix-rest-api');

const pretix = new PretixRestApi({
  url: 'https://xxx.xxxxxxxx.xx',
  token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
});

Options

OptionTypeRequiredDescription
urlStringyesYour pretix url
tokenStringyesYour token
organizerStringnoIf exists, it will be added to all requests
versionStringnoAPI Version default is v1
encodingStringnoEncoding, default is utf-8
timeoutIntegernoDefine the request timeout
axiosConfigObjectnoDefine the custom Axios config, also override this library options

Methods

GET

  • .get(endpoint)
  • .get(endpoint, params)
ParamsTypeDescription
endpointStringPretix API endpoint, example: events or items
paramsObjectQuery strings params

POST

  • .post(endpoint, data)
  • .post(endpoint, data, params)
ParamsTypeDescription
endpointStringPretix API endpoint, example: events or items
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params

PUT

  • .put(endpoint, data)
  • .put(endpoint, data, params)
ParamsTypeDescription
endpointStringPretix API endpoint, example: events or items
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params

PATCH

  • .patch(endpoint, data)
  • .patch(endpoint, data, params)
ParamsTypeDescription
endpointStringPretix API endpoint, example: events or items
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params

DELETE

  • .delete(endpoint)
  • .delete(endpoint, params)
ParamsTypeDescription
endpointStringPretix API endpoint, example: events or items
paramsObjectQuery strings params

Example of use can see in test and test with

yarn test

or

npm test

Release History

  • 2023-09-18 - v1.0.0 - Initial release.
1.0.1

2 years ago

1.0.0

2 years ago