REST API

Prev

The HTTP interface of the Biotoolkit Monomer Service. It is the interface Ideation and the other Biotoolkit services use, and it is available to your own integrations.

Base URL and Swagger UI

Item Value
Base path https://<host>/HELM2MonomerService/rest
Swagger UI https://<host>/HELM2MonomerService/
OpenAPI document https://<host>/HELM2MonomerService/rest/openapi.json
Version GET /rest/Version returns the deployed service version as plain text

Ask your Discngine contact for the host of your deployment. The Swagger UI is the authoritative description of the request and response schemas for the version you are running.

Authentication

Every request carries a JWT, presented as Authorization: Bearer <token> and issued through the Discngine Admin Center. The token identifies your organisation, and every read and write is scoped to it: you see the public library and your own monomers, and nobody else's. A request without a valid token is answered with 401.

Public monomers are readable by everyone and writable by nobody: a write against one returns 403.

Error envelope

Errors carry a JSON body with an outcome and a message:

outcome Status Meaning
INVALID_PARAMETER 400 A path or query parameter is not acceptable
NOT_FOUND 404 No monomer, rule or image matches
VALIDATION_FAILED 409 The monomer violates a rule: duplicate symbol, duplicate structure, missing field, malformed R-groups. A duplicate adds conflictingSymbol and conflictingMonomerId, naming the existing monomer.
ARCHIVED_MATCH 409 The symbol or structure matches a deleted monomer. Adds matchType and archived[]; revive it, or repeat the PUT with force=true.
INTERNAL_ERROR 500 Unexpected failure

503 means the database or the chemistry service is unavailable, and carries Retry-After: 30. 501 means the operation is not supported by the storage backend of the deployment.

Monomers

{polymertype} is PEPTIDE, RNA or CHEM. Read operations also accept ALL.

Method Path Description
GET /monomer/{polymertype} List monomers. Query: monomertype, filter with filterField set to name or symbol, limit, offset. Returns {offset, limit, total, monomers: [...]}.
GET /monomer/{polymertype}/{symbolOrId} One monomer. A segment made only of digits is read as an identifier, anything else as a symbol; pass by=symbol or by=id to force it. version=<n> on an identifier returns an archived version.
PUT /monomer/{polymertype}/{symbol} Create or update the monomer with that symbol. Body: a monomer object. force=true registers a new monomer even when a deleted one matches; without it the request is refused with ARCHIVED_MATCH.
DELETE /monomer/{polymertype}/{symbolOrId} Delete, archiving the state. force=true also removes the monomer from its monomer sets. purge=true erases the monomer and all its archived versions, irreversibly. force and purge cannot be combined.
GET /monomer/{polymertype}/{id}/versions Archived versions, newest first. Empty for a monomer with no history.
POST /monomer/{polymertype}/{id}/revive Put a deleted monomer back under its identifier, with its metadata and set memberships. 409 when a live monomer holds its symbol, name or structure.

Monomer object

{
  "symbol": "Deg",
  "name": "Diethylglycine",
  "polymerType": "PEPTIDE",
  "monomerType": "Backbone",
  "naturalAnalog": "X",
  "smiles": "CCC(CC)(N[*:1])C([*:2])=O",
  "author": "M. Curie",
  "rgroups": [
    {"label": "R1", "capGroupName": "H",  "capGroupSMILES": "[*:1][H]", "alternateId": "R1-H"},
    {"label": "R2", "capGroupName": "OH", "capGroupSMILES": "O[*:2]",   "alternateId": "R2-OH"}
  ]
}

symbol, name, polymerType, monomerType and a structure, smiles or molfile, are required. id, createDate and versionNo are server-owned and ignored on input. capGroupSMILES may be omitted: it is derived from the cap group name. See Monomer Fields.

Validation messages returned with 409:

Message Meaning
Symbol already exists Creation with a symbol in use
Symbol does not exist Update of an unknown symbol
Duplicate SMILES structure exists Same canonical structure as a live monomer of the polymer type
Monomer has no Symbol, Monomer has no Natural Analog Missing field
Monomer has no R-Groups No attachment point in the structure
Number of RGroups does not start by one or does not raise correctly Labels are not R1, R2, … without a gap
Number of R-Groups in Attachmentlist is NOT equal to number of R-Groups in Smiles rgroups and the structure disagree
Labels of RGroups do not match An rgroups label has no dummy atom

Bulk import

Method Path Description
POST /monomer/import Import a batch. Body: a JSON array of monomer objects, or multipart/form-data with a file part in JSON, SDF, CSV or XLSX. format= overrides the extension. mode=async queues the job.
GET /monomer/import/{jobId} Job status. Redirects with 303 to the result once finished.
GET /monomer/import/{jobId}/result Per-row outcome, status 207.
GET /monomer/import/capabilities The limits of the deployment: row caps, upload size, formats.

A synchronous import returns 207 directly and is limited to 100 rows by default. Above that, or above the upload size, the service answers 413 with the instruction to use mode=async. An asynchronous import returns 202 with a Location header to poll. An organisation is limited to a few submissions per minute and a few concurrent jobs; 429 and 503 name the limit that was hit.

Flat-file conventions for this endpoint: column names are matched ignoring case, spaces, underscores and hyphens; CSV is semicolon-delimited; the rgroups cell is R1:H;R2:OH in one quoted cell; SDF data fields R1 to R10 carry the cap group names. Unlike the application's import page, name and monomer_type are required here.

Result body:

{
  "rows": [
    {"index": 0, "symbol": "Ahp", "status": "CREATED", "errors": []},
    {"index": 1, "symbol": "MeNva", "status": "ALREADY_EXISTS_SYMBOL", "errors": ["already-exists: symbol MeNva"]},
    {"index": 2, "symbol": "PEG2", "status": "FAILED", "errors": ["validation: Invalid cap group \"OME\" for R2. Valid values: H, OH, NH2, Azide, Ethynyl"]}
  ],
  "counts": {"created": 1, "updated": 0, "alreadyExists": 1, "duplicateStructure": 0, "failed": 1},
  "total": 3
}

Rows keep the input order. ALREADY_EXISTS_SYMBOL and DUPLICATE_STRUCTURE are benign: the monomer is already there. FAILED is the only error status. Error strings start with a category, parse:, validation:, conversion:, duplicate-structure:, already-exists:, timeout:, persist: or failed:, and never contain database or toolkit internals; a reference such as (ref: 1a2b3c4d5e6f) lets Discngine support find the detail. Re-submitting a batch is safe: the key is the symbol within the polymer type.

Images

Method Path Description
GET /svg/{polymertype}/{symbol} The stored drawing, image/svg+xml
PUT /svg/{polymertype}/{symbol} Regenerate the drawing of one private monomer
PUT /svg/{polymertype} Regenerate the drawings of all private monomers of the type

Rules

HELM business rules, evaluated by the notation toolkit when a sequence is validated.

Method Path Description
GET /rule All rules
GET /rule/{id} One rule
PUT /rule Create or update the rule in the body
DELETE /rule/{id} Delete

Related