Skip to content

Commit 5ddebe2

Browse files
committed
chore: add examples to use the API
1 parent 6a8836b commit 5ddebe2

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

README.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Now use _docker compose_ to start the system (in daemon mode):
4444
> [!NOTE]
4545
> Initially, the property _MB_DB_INIT_ is set to _true_. Change that value to _false_ after the database was filled within the first start. The database filling takes some time. The _mb3tool_ service is responsible for that and stops after finishing that task.
4646
47-
The frontend can (by default) be accessed in the webbrowser at http://localhost:8080/MassBank3/.
47+
The frontend can (by default) be accessed in the webbrowser at http://localhost:8080/MassBank/.
4848

4949
To stop the system use:
5050

@@ -80,6 +80,64 @@ Description is coming soon.
8080

8181
# REST API
8282

83-
There is a [graphical interface](https://msbi.ipb-halle.de/MassBank-api/ui/) via Swagger UI to have insights into the different API endpoints and their specifications.
83+
There is a [graphical interface](https://msbi.ipb-halle.de/MassBank-api/ui/) by means of Swagger UI to have insights into the different API endpoints and their specifications at our test instance.
8484

85-
Further descriptions will be available soon.
85+
To access this on your running instance, just visit the API URL in the browser. By default it is http://localhost:8081 and is definded by the environment variable _MB3_API_URL_.
86+
87+
## Examples
88+
89+
### _/records_ Endpoint
90+
91+
#### InChIKey
92+
93+
In order to get all records from the running instance at the API URL with an InChIKey of _KWILGNNWGSNMPA-UHFFFAOYSA-N_ call the following URL:
94+
95+
{MB3_API_URL}/records?inchi_key=KWILGNNWGSNMPA-UHFFFAOYSA-N
96+
97+
The corresponding URL with default value (http://localhost:8081) is:
98+
99+
http://localhost:8081/records?inchi_key=KWILGNNWGSNMPA-UHFFFAOYSA-N
100+
101+
For example, to obtain the results via cURL use:
102+
103+
curl -X GET "http://localhost:8081/records?inchi_key=KWILGNNWGSNMPA-UHFFFAOYSA-N"
104+
105+
The result is a set of complete MassBank records in JSON format.
106+
107+
#### Compound Name
108+
109+
To receive all records to the compound class _natural product_ use:
110+
111+
http://localhost:8081/records?compound_class=natural+product
112+
113+
### _/records/search_ Endpoint
114+
115+
#### Compound Class
116+
117+
To receive all accession belonging to the compound class _natural product_ use:
118+
119+
http://localhost:8081/records/search?compound_class=natural+product
120+
121+
The result is a set of MassBank record IDs (accessions).
122+
123+
#### MS Type and Ion Mode
124+
125+
A request for searching MS2 spectra and negative ion mode looks like:
126+
127+
http://localhost:8081/records/search?ms_type=MS2&ion_mode=NEGATIVE
128+
129+
#### Similarity Search
130+
131+
A similarity search request with the semicolon-separated tuples (m/z value, rel. intensity)
132+
133+
133.0648;225
134+
151.0754;94
135+
155.9743;112
136+
161.0597;999
137+
179.0703;750
138+
139+
and threshold value 0.8 looks like:
140+
141+
http://localhost:8081/records/search?peak_list=133.0648%3B225%2C151.0754%3B94%2C155.9743%3B112%2C161.0597%3B999%2C179.0703%3B750&peak_list_threshold=0.8
142+
143+
The result is a set of MassBank record IDs (accessions) and the corresponding similarity score in JSON format. The calculation is done by the [matchms](https://github.com/matchms/matchms) package used in our [similarity service](https://github.com/MassBank/MassBank3-similarity-service).

0 commit comments

Comments
 (0)