# SampleDB API Wrapper
## What it does
This package is a simple Python wrapper for the [HTTP API](https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/developer_guide/api.html) of [SampleDB](https://scientific-it-systems.iffgit.fz-juelich.de/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
```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](https://ag-salinga.zivgitlabpages.uni-muenster.de/sampledb-api-wrapper/Examples.html).
### 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).
```matlab
% 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](https://ag-salinga.zivgitlabpages.uni-muenster.de/sampledb-api-wrapper/Examples.html) can be used in Matlab.
## Documentation
The current API documentation can be found [here](https://ag-salinga.zivgitlabpages.uni-muenster.de/sampledb-api-wrapper).
Further details on the input and output of each function (usually JSON) can be found in the documentation of the [HTTP API](https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/developer_guide/api.html).
## What works
The full HTTP API of SampleDB is supported. This includes
- [x] Authentication
- [x] Objects
- [x] Reading a list of all objects
- [x] Getting the current object version
- [x] Reading an object version
- [x] Creating a new object
- [x] Updating an object / Creating a new object version
- [x] Getting related objects
- [x] Object permissions
- [x] Reading whether an object is public
- [x] Setting whether an object is public
- [x] Reading all users' permissions
- [x] Reading a user's permissions
- [x] Setting a user's permissions
- [x] Reading all groups' permissions
- [x] Reading a group's permissions
- [x] Setting a group's permissions
- [x] Reading all project groups' permissions
- [x] Reading a project group's permissions
- [x] Setting a project group's permissions
- [x] Instruments
- [x] Reading a list of all instruments
- [x] Reading an instrument
- [x] Instrument log entries
- [x] Reading a list of all log entries for an instrument
- [x] Reading an instrument log entry
- [x] Reading a list of all log categories for an instrument
- [x] Reading an instrument log category
- [x] Reading a list of all file attachments for a log entry
- [x] Reading a file attachment for a log entry
- [x] Reading a list of all object attachments for a log entry
- [x] Reading an object attachment for a log entry
- [x] Creating an instrument log entry
- [x] Actions
- [x] Reading a list of all actions
- [x] Reading an action
- [x] Action types
- [x] Reading a list of all action types
- [x] Reading an action type
- [x] Users
- [x] Reading a list of all users
- [x] Reading a user
- [x] Reading the current user
- [x] Locations
- [x] Reading a list of all locations
- [x] Reading a location
- [x] Reading a list of an object's locations
- [x] Reading an object's location
- [x] Location types
- [x] Reading a list of all location types
- [x] Reading a location type
- [x] Files
- [x] Reading a list of an object's files
- [x] Reading information for a file
- [x] Uploading a file
- [x] Posting a link
- [x] Comments
- [x] Reading a list of an object’s comments
- [x] Reading information for a comment
- [x] Posting a comment
Raw data
{
"_id": null,
"home_page": "https://zivgitlab.uni-muenster.de/ag-salinga/sampledb-api-wrapper",
"name": "sampledbapi",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "api sampledb",
"author": "AG Salinga, WWU M\u00fcnster",
"author_email": "itsaling@uni-muenster.de",
"download_url": "",
"platform": null,
"description": "# SampleDB API Wrapper\n## What it does\nThis package is a simple Python wrapper for the [HTTP API](https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/developer_guide/api.html) of [SampleDB](https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/), a web-based sample and measurement metadata database developed at PGI and JCNS.\n\nThis Python wrapper may also be used e.g. in Matlab and Julia.\n\n## Installation\nUser installation using pip:\n```\npip install --upgrade --user sampledbapi\n```\n\nSystem installation using pip:\n```\npip install --upgrade sampledbapi\n```\n\n## Example usage\n\n### Python\n```python\nfrom sampledbapi import *\n\nserver_address = ...\napi_key = ...\n\n# Authentication\nauthenticate(server_address, api_key)\n\n# Simple queries\nprint(actions.get_list())\nprint(objects.get(123))\nprint(instruments.get_list())\n\n# Advanced search\nprint(objects.get_list(\"material == \\\"Sb\\\"\"))\n```\n\nMore examples for usage in Python can be found [here](https://ag-salinga.zivgitlabpages.uni-muenster.de/sampledb-api-wrapper/Examples.html).\n\n### Matlab\n\nYou need a working installation of Python and `sampledbapi` installed for this to work.\nSome type conversions are needed (e.g. to pass integers).\n\n```matlab\n% Authentication\npy.sampledbapi.authenticate(\"https://...\", \"your_api_key\")\n\n% Simple queries\nprint(instruments.get_list())\npy.sampledbapi.objects.get(py.int(123))\npy.sampledbapi.instruments.get_list())\n\n% Advanced search\nl = py.sampledbapi.objects.get_list('material == \"Sb\"')\nobj = l{1}\nobj.data\n```\n\nIn an analogous way, the Python examples shown [here](https://ag-salinga.zivgitlabpages.uni-muenster.de/sampledb-api-wrapper/Examples.html) can be used in Matlab.\n\n## Documentation\n\nThe current API documentation can be found [here](https://ag-salinga.zivgitlabpages.uni-muenster.de/sampledb-api-wrapper).\nFurther details on the input and output of each function (usually JSON) can be found in the documentation of the [HTTP API](https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/developer_guide/api.html).\n\n## What works\n\nThe full HTTP API of SampleDB is supported. This includes\n\n- [x] Authentication\n- [x] Objects\n - [x] Reading a list of all objects\n - [x] Getting the current object version\n - [x] Reading an object version\n - [x] Creating a new object\n - [x] Updating an object / Creating a new object version\n - [x] Getting related objects\n- [x] Object permissions\n - [x] Reading whether an object is public\n - [x] Setting whether an object is public\n - [x] Reading all users' permissions\n - [x] Reading a user's permissions\n - [x] Setting a user's permissions\n - [x] Reading all groups' permissions\n - [x] Reading a group's permissions\n - [x] Setting a group's permissions\n - [x] Reading all project groups' permissions\n - [x] Reading a project group's permissions\n - [x] Setting a project group's permissions\n- [x] Instruments\n - [x] Reading a list of all instruments\n - [x] Reading an instrument\n- [x] Instrument log entries\n - [x] Reading a list of all log entries for an instrument\n - [x] Reading an instrument log entry\n - [x] Reading a list of all log categories for an instrument\n - [x] Reading an instrument log category\n - [x] Reading a list of all file attachments for a log entry\n - [x] Reading a file attachment for a log entry\n - [x] Reading a list of all object attachments for a log entry\n - [x] Reading an object attachment for a log entry\n - [x] Creating an instrument log entry\n- [x] Actions\n - [x] Reading a list of all actions\n - [x] Reading an action\n- [x] Action types\n - [x] Reading a list of all action types\n - [x] Reading an action type\n- [x] Users\n - [x] Reading a list of all users\n - [x] Reading a user\n - [x] Reading the current user\n- [x] Locations\n - [x] Reading a list of all locations\n - [x] Reading a location\n - [x] Reading a list of an object's locations\n - [x] Reading an object's location\n- [x] Location types\n - [x] Reading a list of all location types\n - [x] Reading a location type\n- [x] Files\n - [x] Reading a list of an object's files\n - [x] Reading information for a file\n - [x] Uploading a file\n - [x] Posting a link\n- [x] Comments\n - [x] Reading a list of an object\u2019s comments\n - [x] Reading information for a comment\n - [x] Posting a comment\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "API wrapper for SampleDB",
"version": "0.6.5",
"project_urls": {
"Homepage": "https://zivgitlab.uni-muenster.de/ag-salinga/sampledb-api-wrapper"
},
"split_keywords": [
"api",
"sampledb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1f07e6fcce72df09bc42a2ae793d689d0bf0a50bb58d20d5ede098790748b357",
"md5": "01581a0ae15ce69b4b58b6e1c48089c8",
"sha256": "fd498e754ba93a0e3d8219f9ef76bde266951ca7123940009e3370999c61f015"
},
"downloads": -1,
"filename": "sampledbapi-0.6.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "01581a0ae15ce69b4b58b6e1c48089c8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 15379,
"upload_time": "2023-12-01T12:12:44",
"upload_time_iso_8601": "2023-12-01T12:12:44.213522Z",
"url": "https://files.pythonhosted.org/packages/1f/07/e6fcce72df09bc42a2ae793d689d0bf0a50bb58d20d5ede098790748b357/sampledbapi-0.6.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-01 12:12:44",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "sampledbapi"
}