The LIPID MAPS® REST service enables access to a variety of data (including lipid structures and lipid-related genes/proteins) using HTTP requests. These requests may be carried out using a web browser or may be embedded in 3rd party applications or scripts to enable programmatic access. Most modern programming languages including PHP, Perl, Python, Java and Javascript have the capability to create HTTP request and interact with datasets such as this REST service.
The REST URL is composed of 3 main parts:
If you have a LIPID MAPS account, you can send your personal download token with each request so it is associated with your account. The token is the 20-letter code shown on your profile page once you are signed in. There are two ways to send it: in the URL, or in a request header. Pick one with the tabs below; the URL creator and the examples follow your choice.
Keep your token private, since it identifies you; do not publish scripts or URLs that contain it. You can replace it from your profile if it is ever exposed.
Put the token straight after /rest/. The rest of the URL is unchanged:
/rest/
https://www.lipidmaps.org/rest/<YOUR_TOKEN>/compound/lm_id/LMFA01010001/all
Simplest to use: works in a browser, a spreadsheet or any tool that can fetch a URL. The token is visible in the URL, so it can end up in browser history and server logs.
Keep the URL as it is and send the token as an Authorization: Bearer header (or as X-Download-Token: <token>):
Authorization: Bearer
X-Download-Token: <token>
Authorization: Bearer <YOUR_TOKEN>
The token stays out of the URL, logs and browser history. A browser cannot add the header when you click a link, so use one of the snippets below in your script. They fetch the URL from the creator further down.
curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://www.lipidmaps.org/rest/compound/lm_id/LMFA01010001/all"
wget --header="Authorization: Bearer YOUR_TOKEN" \ -O result.txt "https://www.lipidmaps.org/rest/compound/lm_id/LMFA01010001/all"
import requests token = "YOUR_TOKEN" url = "https://www.lipidmaps.org/rest/compound/lm_id/LMFA01010001/all" response = requests.get(url, headers={"Authorization": f"Bearer {token}"}) response.raise_for_status() print(response.text) # or response.json() for JSON output
library(httr) token <- "YOUR_TOKEN" url <- "https://www.lipidmaps.org/rest/compound/lm_id/LMFA01010001/all" response <- GET(url, add_headers(Authorization = paste("Bearer", token))) stop_for_status(response) cat(content(response, as = "text", encoding = "UTF-8"))
<?php $token = 'YOUR_TOKEN'; $url = 'https://www.lipidmaps.org/rest/compound/lm_id/LMFA01010001/all'; $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token], CURLOPT_RETURNTRANSFER => true, ]); $response = curl_exec($ch); curl_close($ch); echo $response;
// Node.js 18+ (built-in fetch). The REST service does not allow // cross-origin requests, so this will not run in a web page on another site. const token = 'YOUR_TOKEN'; const url = 'https://www.lipidmaps.org/rest/compound/lm_id/LMFA01010001/all'; const response = await fetch(url, { headers: { Authorization: `Bearer ${token}` }, }); if (!response.ok) throw new Error(`HTTP ${response.status}`); console.log(await response.text());
Sign in to fill in your own token; until then, replace YOUR_TOKEN with the token from your profile.
YOUR_TOKEN
The interactive "REST url" creator below shows the complete list of currently available options for this service.
URL:
REST (REpresentational State Transfer) is an architectural style consisting of a coordinated set of architectural constraints applied to components, connectors, and data elements, within a distributed hypermedia system. REST ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements.
Fielding, Roy T. (2000). "Chapter 5: Representational State Transfer (REST)". Architectural Styles and the Design of Network-based Software Architectures (Ph.D.). University of California, Irvine. Fielding, Roy T.; Taylor, Richard N. (May 2002), "Principled Design of the Modern Web Architecture" (PDF), ACM Transactions on Internet Technology (TOIT) (New York: Association for Computing Machinery) 2 (2): 115-150, doi:10.1145/514183.514185, ISSN 1533-5399 REST Wikipedia page
JSON (JavaScript Object Notation) is a lightweight data-interchange format which human readable and also convenient for computers to parse and generate. JSON is a text format that is completely language independent but uses conventions that are familiar to most common programming languages. Official JSON website
LIPID MAPS uses cookies to keep the site working, to remember your choices, and — only if you allow it — to understand how the site is used so we can improve it. Choose what you are happy with below. You can change your mind at any time from Manage Cookies in the footer.
Register to help us understand how LIPID MAPS resources are used, measure our impact and improve our services.