Skip to main content

API wrapper for SampleDB

Project description

SampleDB API Wrapper

What it does

This package is a simple Python wrapper for the HTTP API of SampleDB, a web-based sample and measurement metadata database developed at PGI and JCNS.

This Python wrapper may also be used e.g. in Matlab and Julia.

Installation

User installation using pip:

pip install --upgrade --user sampledbapi

System installation using pip:

pip install --upgrade sampledbapi

Example usage

Python

from sampledbapi import *

server_address = ...
api_key = ...

# Authentication
authenticate(server_address, api_key)

# Simple queries
print(actions.getList())
print(objects.get(123))
print(instruments.getList())

# Advanced search
print(objects.getList("material == \"Sb\""))

Matlab

You need a working installation of Python and sampledbapi installed for this to work. Some type conversions are needed (e.g. to pass integers).

% Authentication
py.sampledbapi.authenticate("https://...", "your_api_key")

% Simple queries
print(instruments.getList())
py.sampledbapi.objects.get(py.int(123))
py.sampledbapi.instruments.getList())

% Advanced search
l = py.sampledbapi.objects.getList('material == "Sb"')
obj = l{1}
obj.data

Documentation

The current API documentation can be found here. Further details on the input and output of each function (usually JSON) can be found in the documentation of the HTTP API.

What works

The full HTTP API of SampleDB is supported. This includes

  • Authentication
  • Objects
    • Reading a list of all objects
    • Getting the current object version
    • Reading an object version
    • Creating a new object
    • Updating an object / Creating a new object version
  • Object permissions
    • Reading whether an object is public
    • Setting whether an object is public
    • Reading all users' permissions
    • Reading a user's permissions
    • Setting a user's permissions
    • Reading all groups' permissions
    • Reading a group's permissions
    • Setting a group's permissions
    • Reading all project groups' permissions
    • Reading a project group's permissions
    • Setting a project group's permissions
  • Instruments
    • Reading a list of all instruments
    • Reading an instrument
  • Instrument log entries
    • Reading a list of all log entries for an instrument
    • Reading an instrument log entry
    • Reading a list of all log categories for an instrument
    • Reading an instrument log category
    • Reading a list of all file attachments for a log entry
    • Reading a file attachment for a log entry
    • Reading a list of all object attachments for a log entry
    • Reading an object attachment for a log entry
    • Creating an instrument log entry
  • Actions
    • Reading a list of all actions
    • Reading an action
  • Action types
    • Reading a list of all action types
    • Reading an action type
  • Users
    • Reading a list of all users
    • Reading a user
    • Reading the current user
  • Locations
    • Reading a list of all locations
    • Reading a location
    • Reading a list of an object's locations
    • Reading an object's location
  • Files
    • Reading a list of an object's files
    • Reading information for a file
    • Uploading a file
    • Posting a link
  • Comments
    • Reading a list of an object’s comments
    • Reading information for a comment
    • Posting a comment

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sampledbapi-0.3.3.tar.gz (10.8 kB view details)

Uploaded Source

Built Distributions

sampledbapi-0.3.3-py3.10.egg (24.7 kB view details)

Uploaded Source

sampledbapi-0.3.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file sampledbapi-0.3.3.tar.gz.

File metadata

  • Download URL: sampledbapi-0.3.3.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for sampledbapi-0.3.3.tar.gz
Algorithm Hash digest
SHA256 28ca905fd90ba4b873bbcb31bbb86badac48446a9c3b5a94b0e3fd16430367c3
MD5 3e7e5768341d2b53c6cd5ae9b40c7185
BLAKE2b-256 4ca67b142cce2805d8d615f89ccbf56ec0bb0d4d7cbde49120ffa1cbd0e0e1f4

See more details on using hashes here.

File details

Details for the file sampledbapi-0.3.3-py3.10.egg.

File metadata

  • Download URL: sampledbapi-0.3.3-py3.10.egg
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for sampledbapi-0.3.3-py3.10.egg
Algorithm Hash digest
SHA256 709e7c6b10716184cd866dd16733cf8f1674aea13149f1505f9f2c94045703e5
MD5 6b9123347cab6b324eaec0a9555b621d
BLAKE2b-256 0bd95661bc8c700d0a0f882fa27254434068d363fdd102e343446b58ffa37b2f

See more details on using hashes here.

File details

Details for the file sampledbapi-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: sampledbapi-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for sampledbapi-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cefa59bdaec4bb2c027ab97cb7e461fe6ab4b42e5dfb3b5f2498cf39b98d82ff
MD5 d56c9f3d49fa4b2846a0a8f1c9caed8e
BLAKE2b-256 698b3e415dbb8d5c40eff6adbbc026d1e04dea787c5d6ec70300baea9bf443e6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page