Developers/API

From PartKeepr Wiki
Revision as of 17:31, 28 April 2016 by Felicitus (talk | contribs)
Jump to: navigation, search

Introduction

PartKeepr uses JSON-LD/Hydra-CG as API standards.

Authentication can be done by HTTP Basic and/or WSSE. Once authenticated, a session cookie is set, but you can also re-send the HTTP Basic and/or WSSE auth on every request.

API Documentation

http://demo.partkeepr.org/api/apidoc

To view the API Doc, you need to go to http://demo.partkeepr.org to receive a session cookie.

Unfortunately a user-friendly API doc is not available yet due to a problem with a 3rd party library. However, the hydra documentation should give some clues which API calls are available.

Example HTTP Request

GET https://demo.partkeepr.org/api/parts

HTTP Headers:
Authorization:Basic YWRtaW46YWRtaW4=
Host:demo.partkeepr.org

CURL Examples

Basic Example

Retrieves all parts with pagination defaults:

curl --basic --user admin:admin http://demo.partkeepr.org/api/parts

Pagination example

curl --basic --user admin:admin http://demo.partkeepr.org/api/parts?page=5&start=0&itemsPerPage=50

Filtering examples

Filtering by the storage location:

curl --basic --user admin:admin http://demo.partkeepr.org/api/parts?filter={"property": "storageLocation", "operator": "=", "value": "/api/storage_locations/3"}

Filtering by the status

curl --basic --user admin:admin http://demo.partkeepr.org/api/parts?filter={"property": "status", "operator": "LIKE", "value": "new"}