Skip to main content

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

Metadata

Release files for sampledbapi 0.6.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sampledbapi 0.6.6
File Size Uploaded
sampledbapi-0.6.6.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sampledbapi 0.6.6
File Interpreter ABI Platform
sampledbapi-0.6.6-py3-none-any.whl Python 3 none any Details

Total release size: 34.7 kB

Release files / sampledbapi-0.6.6.tar.gz

Download URL sampledbapi-0.6.6.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
75f3678eca7b32b4e35d697e3b1b8133f718ec3b858564d6bf340c2b9646855c
BLAKE2b-256 checksum
How to use checksums
cf29eb1161e812604102fe0139403cfbb155adb943bf67982204446059637e33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / sampledbapi-0.6.6-py3-none-any.whl

Download URL sampledbapi-0.6.6-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
896b524883d6cc0604eb24980b8a1758f38741715d8544622ecdb194650d3638
BLAKE2b-256 checksum
How to use checksums
79bc111b45d517f501dfdaebd3ee148faffe456129531e8c97ad44d43fe8bd27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.6.6 This release

2 release files

0.6.5

1 release file

0.6.4

1 release file

0.6.2

3 release files

0.6.1

3 release files

0.6.0

3 release files

0.5.0

3 release files

0.4.0

3 release files

0.3.3

3 release files

0.3.2

3 release files

0.3.1

3 release files

0.3.0

3 release files

0.2.1

3 release files

0.2.0

3 release files

0.1.0

3 release files

0.0.7

3 release files

0.0.6

3 release files

0.0.4

3 release files

0.0.3

3 release files

0.0.2

3 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page