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.get_list())
print(objects.get(123))
print(instruments.get_list())

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

More examples for usage in Python can be found here.

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.get_list())
py.sampledbapi.objects.get(py.int(123))
py.sampledbapi.instruments.get_list())

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

In an analogous way, the Python examples shown here can be used in Matlab.

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
    • Getting related objects
  • 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
  • Location types
    • Reading a list of all location types
    • Reading a location type
  • 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.6.6.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sampledbapi-0.6.6-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sampledbapi-0.6.6.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sampledbapi-0.6.6.tar.gz
Algorithm Hash digest
SHA256 75f3678eca7b32b4e35d697e3b1b8133f718ec3b858564d6bf340c2b9646855c
MD5 8b37c2d8cf2faa0f466669115cc67068
BLAKE2b-256 cf29eb1161e812604102fe0139403cfbb155adb943bf67982204446059637e33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sampledbapi-0.6.6-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sampledbapi-0.6.6-py3-none-any.whl
Algorithm Hash digest
SHA256 896b524883d6cc0604eb24980b8a1758f38741715d8544622ecdb194650d3638
MD5 66abdb4333ef6a20b372843bdbb62cbb
BLAKE2b-256 79bc111b45d517f501dfdaebd3ee148faffe456129531e8c97ad44d43fe8bd27

See more details on using hashes here.

Supported by

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