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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file sampledbapi-0.6.5-py3-none-any.whl
.
File metadata
- Download URL: sampledbapi-0.6.5-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd498e754ba93a0e3d8219f9ef76bde266951ca7123940009e3370999c61f015 |
|
MD5 | 01581a0ae15ce69b4b58b6e1c48089c8 |
|
BLAKE2b-256 | 1f07e6fcce72df09bc42a2ae793d689d0bf0a50bb58d20d5ede098790748b357 |