Rest Cheat Sheet

Posted : admin On 1/29/2022
  1. Rest Assured Cheat Sheet Pdf
  2. Jigglypuff Rest Cheat Sheet
  • Probably the Best Regular Expression Cheat Sheet on the Net. The most commonly used metacharacters in Python, PHP, Perl, JavaScript, and Ruby. Rest of the line is.
  • Stateful services are out of scope of this Cheat Sheet: Passing state from client to backend, while making the service technically stateless, is an anti-pattern that should also be avoided as it is prone to replay and impersonation attacks. In order to implement flows with REST APIs, resources are typically created, read, updated and deleted.

In this article we will provide Brief definition of REST (Representational State Transfer) with couple of cheat sheet from web. Brief definition of REST (Representational State Transfer): Representational state transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services. Web services that conform to the Continue reading 'REST.

Last revision (mm/dd/yy): 09/4/2018

  • 8Validate content types
  • 12Security headers

REST (or REpresentational State Transfer) is an architectural style first described in Roy Fielding's Ph.D. dissertation on Architectural Styles and the Design of Network-based Software Architectures. It evolved as Fielding wrote the HTTP/1.1 and URI specs and has been proven to be well-suited for developing distributed hypermedia applications. While REST is more widely applicable, it is most commonly used within the context of communicating with services via HTTP.

The key abstraction of information in REST is a resource. A REST API resource is identified by a URI, usually a HTTP URL. REST components use connectors to perform actions on a resource by using a representation to capture the current or intended state of the resource and transferring that representation. The primary connector types are client and server, secondary connectors include cache, resolver and tunnel. In order to implement flows with REST APIs, resources are typically created, read, updated and deleted. For example, an ecommerce site may offer methods to create an empty shopping cart, to add items to the cart and to check out the cart.

Another key feature of REST applications is the use of standard HTTP verbs and error codes in the pursuit or removing unnecessary variation among different services.

Another key feature of REST applications is the use of HATEOS or Hypermedia as the Engine of Application State. This provides REST applications a self-documenting nature making it easier for developers to interact with a REST service without a priori knowledge.

Secure REST services must only provide HTTPS endpoints. This protects authentication credentials in transit, for example passwords, API keys or JSON Web Tokens. It also allows clients to authenticate the service and guarantees integrity of the transmitted data.

See the Transport Layer Protection Cheat Sheet for additional information.

Consider the use of mutually authenticated client-side certificates to provide additional protection for highly privileged web services.

Non-public REST services must perform access control at each API endpoint. Web services in monolithic applications implement this by means of user authentication, authorisation logic and session management. This has several drawbacks for modern architectures which compose multiple micro services following the RESTful style.

  • in order to minimise latency and reduce coupling between services, the access control decision should be taken locally by REST endpoints
  • user authentication should be centralised in a Identity Provider (IdP), which issues access tokens

There seems to be a convergence towards using JSON Web Tokens (JWT) as the format for security tokens. JWTs are JSON data structures containing a set of claims that can be used for access control decisions. A cryptographic signature or message authentication code (MAC) can be used to protect the integrity of the JWT.

Rest Assured Cheat Sheet Pdf

  • Ensure JWTs are integrity protected by either a signature or a MAC. Do not allow the unsecured JWTs: {'alg':'none'}. See
  • In general, signatures should be preferred over MACs for integrity protection of JWTs.

If MACs are used for integrity protection, every service that is able to validate JWTs can also create new JWTs using the same key. This means that all services using the same key have to mutually trust each other. Another consequence of this is that a compromise of any service also compromises all other services sharing the same key. See for additional information.

The relying party or token consumer validates a JWT by verifying its integrity and claims contained.

  • A relying party must verify the integrity of the JWT based on its own configuration or hard-coded logic. It must not rely on the information of the JWT header to select the verification algorithm. See and

Some claims have been standardised and should be present in JWT used for access controls. At least the following of the standard claims should be verified:

  • 'iss' or issuer - is this a trusted issuer? Is it the expected owner of the signing key?
  • 'aud' or audience - is the relying party in the target audience for this JWT?
  • 'exp' or expiration time - is the current time before the end of the validity period of this token?
  • 'nbf' or not before time - is the current time after the start of the validity period of this token?

Jigglypuff Rest Cheat Sheet


Public REST services without access control run the risk of being farmed leading to excessive bills for bandwidth or compute cycles. API keys can be used to mitigate this risk. They are also often used by organisation to monetize APIs; instead of blocking high-frequency calls, clients are given access in accordance to a purchased access plan.

API keys can reduce the impact of denial-of-service attacks. However, when they are issued to third-party clients, they are relatively easy to compromise.

  • Require API keys for every request to the protected endpoint.
  • Return 429 'Too Many Requests' HTTP response code if requests are coming in too quickly.
  • Revoke the API key if the client violates the usage agreement.
  • Do not rely exclusively on API keys to protect sensitive, critical or high-value resources.
  • Apply a whitelist of permitted HTTP Methods e.g. GET, POST, PUT
  • Reject all requests not matching the whitelist with HTTP response code 405 Method not allowed
  • Make sure the caller is authorised to use the incoming HTTP method on the resource collection, action, and record

In Java EE in particular, this can be difficult to implement properly. See Bypassing Web Authentication and Authorization with HTTP Verb Tampering for an explanation of this common misconfiguration.

  • Do not trust input parameters/objects
  • Validate input: length / range / format and type
  • Achieve an implicit input validation by using strong types like numbers, booleans, dates, times or fixed data ranges in API parameters
  • Constrain string inputs with regexps
  • Reject unexpected/illegal content
  • Make use of validation/sanitation libraries or frameworks in your specific language
  • Define an appropriate request size limit and reject requests exceeding the limit with HTTP response status 413 Request Entity Too Large
  • Consider logging input validation failures. Assume that someone who is performing hundreds of failed input validations per second is up to no good.
  • Have a look at input validation cheat sheet for comprehensive explanation
  • Use a secure parser for parsing the incoming messages. If you are using XML, make sure to use a parser that is not vulnerable to XXE and similar attacks.

A REST request or response body should match the intended content type in the header. Otherwise this could cause misinterpretation at the consumer/producer side and lead to code injection/execution.

  • Document all supported content types in your API

Validate request content types

  • Reject requests containing unexpected or missing content type headers with HTTP response status 406 Unacceptable or 415 Unsupported Media Type
  • For XML content types ensure appropriate XML parser hardening, see the cheat sheet
  • Avoid accidentally exposing unintended content types by explicitly defining content types e.g. Jersey (Java) @consumes('application/json'); @produces('application/json'). This avoids XXE-attack vectors for example.

Send safe response content types

It is common for REST services to allow multiple response types (e.g. 'application/xml' or 'application/json', and the client specifies the preferred order of response types by the Accept header in the request.

  • Do NOT simply copy the Accept header to the Content-type header of the response.
  • Reject the request (ideally with a 406 Not Acceptable response) if the Accept header does not specifically contain one of the allowable types.

Services including script code (e.g. JavaScript) in their responses must be especially careful to defend against header injection attack.

  • ensure sending intended content type headers in your response matching your body content e.g. 'application/json' and not 'application/javascript'
  • Avoid exposing management endpoints via Internet.
  • If management endpoints must be accessible via the Internet, make sure that users must use a strong authentication mechanism, e.g. multi-factor.
  • Expose management endpoints via different HTTP ports or hosts preferably on a different NIC and restricted subnet.
  • Restrict access to these endpoints by firewall rules or use of access control lists.
  • Respond with generic error messages - avoid revealing details of the failure unnecessarily
  • Do not pass technical details (e.g. call stacks or other internal hints) to the client
  • Write audit logs before and after security related events
  • Consider logging token validation errors in order to detect attacks
  • Take care of log injection attacks by sanitising log data beforehand

To make sure the content of a given resources is interpreted correctly by the browser, the server should always send the Content-Type header with the correct Content-Type, and preferably the Content-Type header should include a charset. The server should also send an X-Content-Type-Options: nosniff to make sure the browser does not try to detect a different Content-Type than what is actually sent (can lead to XSS).

Additionally the client should send an X-Frame-Options: deny to protect against drag'n drop clickjacking attacks in older browsers.


Cross-Origin Resource Sharing (CORS) is a W3C standard to flexibly specify what cross-domain requests are permitted. By delivering appropriate CORS Headers your REST API signals to the browser which domains, AKA origins, are allowed to make JavaScript calls to the REST service.

  • Disable CORS headers if cross-domain calls are not supported
  • Be as specific as possible and as general as necessary when setting the origins of cross-domain calls
In Spring Boot (Java), for example, CORS support is disabled by default and is only enabled once the endpoints.cors.allowed-origins property has been set. The configuration below permits GET and POST calls from the domain:

RESTful web services should be careful to prevent leaking credentials. Passwords, security tokens, and API keys should not appear in the URL, as this can be captured in web server logs, which makes them intrinsically valuable.

  • In POST/PUT requests sensitive data should be transferred in the request body or request headers
  • In GET requests sensitive data should be transferred in an HTTP Header




  •<id>/action?apiKey=a53f435643de32 (API Key in URL)

HTTP defines status codes [1].When designing REST API, don't just use 200 for success or 404 for error. Always use the semantically appropriate status code for the response.

Here is a non-exhaustive selection of security related REST API status codes. Use it to ensure you return the correct code.

Rest Cheat Sheet
Status codeMessageDescription
200OKResponse to a successful REST API action. The HTTP method can be GET, POST, PUT, PATCH or DELETE
201CreatedThe request has been fulfilled and resource created. A URI for the created resource is returned in the Location header
202AcceptedThe request has been accepted for processing, but processing is not yet complete
400Bad RequestThe request is malformed, such as message body format error
401UnauthorizedWrong or no authentication ID/password provided
403ForbiddenIt's used when the authentication succeeded but authenticated user doesn't have permission to the request resource
404Not FoundWhen a non-existent resource is requested
406UnacceptableThe client presented a content type in the Accept header which is not supported by the server API
405Method Not AllowedThe error for an unexpected HTTP method. For example, the REST API is expecting HTTP GET, but HTTP PUT is used
413Payload too largeUse it to signal that the request size exceeded the given limit e.g. regarding file uploads
415Unsupported Media TypeThe requested content type is not supported by the REST service
429Too Many RequestsThe error is used when there may be DOS attack detected or the request is rejected due to rate limiting
500Internal Server ErrorAn unexpected condition prevented the server from fulfilling the request. Be aware that the response should not reveal internal information that helps an attacker, e.g. detailed error messages or stack traces.
501Not ImplementedThe REST service does not implement the requested operation yet
503Service UnavailableThe REST service is temporarily unable to process the request. Used to inform the client it should retry at a later time.

Erlend Oftedal - [email protected]
Andrew van der Stock - [email protected]
Tony Hsu Hsiang Chih- [email protected]
Johan Peeters - [email protected]
Jan Wolff - [email protected]
Rocco Gränitz - [email protected]

This quick reference of the REST API of Orthanc isautomatically generated from the source code of Orthanc. Clicking onone of the HTTP methods will open its full OpenAPI documentation.

If you are looking for samples, check out the dedicated FAQentry.

/changesGETDELETEList changes
/exportsGETDELETEList exports
/instancesGETPOSTList the available instances
/instances/{id}GETDELETEGet information about some instance
/instances/{id}/anonymizePOSTAnonymize instance
/instances/{id}/attachmentsGETList attachments
/instances/{id}/attachments/{name}GETDELETEPUTList operations on attachments
/instances/{id}/attachments/{name}/compressPOSTCompress attachment
/instances/{id}/attachments/{name}/compressed-dataGETGet attachment (no decompression)
/instances/{id}/attachments/{name}/compressed-md5GETGet MD5 of attachment on disk
/instances/{id}/attachments/{name}/compressed-sizeGETGet size of attachment on disk
/instances/{id}/attachments/{name}/dataGETGet attachment
/instances/{id}/attachments/{name}/is-compressedGETIs attachment compressed?
/instances/{id}/attachments/{name}/md5GETGet MD5 of attachment
/instances/{id}/attachments/{name}/sizeGETGet size of attachment
/instances/{id}/attachments/{name}/uncompressPOSTUncompress attachment
/instances/{id}/attachments/{name}/verify-md5POSTVerify attachment
/instances/{id}/contentGETGet raw tag
/instances/{id}/exportPOSTWrite DICOM onto filesystem
/instances/{id}/fileGETDownload DICOM
/instances/{id}/framesGETList available frames
/instances/{id}/frames/{frame}GETList operations
/instances/{id}/frames/{frame}/image-int16GETDecode a frame (int16)
/instances/{id}/frames/{frame}/image-uint16GETDecode a frame (uint16)
/instances/{id}/frames/{frame}/image-uint8GETDecode a frame (uint8)
/instances/{id}/frames/{frame}/matlabGETDecode frame for Matlab
/instances/{id}/frames/{frame}/previewGETDecode a frame (preview)
/instances/{id}/frames/{frame}/rawGETAccess raw frame
/instances/{id}/frames/{frame}/raw.gzGETAccess raw frame (compressed)
/instances/{id}/frames/{frame}/renderedGETRender a frame
/instances/{id}/headerGETGet DICOM meta-header
/instances/{id}/image-int16GETDecode an image (int16)
/instances/{id}/image-uint16GETDecode an image (uint16)
/instances/{id}/image-uint8GETDecode an image (uint8)
/instances/{id}/matlabGETDecode frame for Matlab
/instances/{id}/metadataGETList metadata
/instances/{id}/metadata/{name}GETDELETEPUTGet metadata
/instances/{id}/modifyPOSTModify instance
/instances/{id}/moduleGETGet instance module
/instances/{id}/patientGETGet parent patient
/instances/{id}/pdfGETGet embedded PDF
/instances/{id}/previewGETDecode an image (preview)
/instances/{id}/reconstructPOSTReconstruct tags of instance
/instances/{id}/renderedGETRender an image
/instances/{id}/seriesGETGet parent series
/instances/{id}/simplified-tagsGETGet human-readable tags
/instances/{id}/statisticsGETGet instance statistics
/instances/{id}/studyGETGet parent study
/instances/{id}/tagsGETGet DICOM tags
/jobsGETList jobs
/jobs/{id}GETGet job
/jobs/{id}/cancelPOSTCancel job
/jobs/{id}/pausePOSTPause job
/jobs/{id}/resubmitPOSTResubmit job
/jobs/{id}/resumePOSTResume job
/jobs/{id}/{key}GETGet job output
/modalitiesGETList DICOM modalities
/modalities/{id}GETDELETEPUTList operations on modality
/modalities/{id}/configurationGETGet modality configuration
/modalities/{id}/echoPOSTTrigger C-ECHO SCU
/modalities/{id}/find(post)(deprecated) Hierarchical C-FIND SCU
/modalities/{id}/find-instance(post)(deprecated) C-FIND SCU for instances
/modalities/{id}/find-patient(post)(deprecated) C-FIND SCU for patients
/modalities/{id}/find-series(post)(deprecated) C-FIND SCU for series
/modalities/{id}/find-study(post)(deprecated) C-FIND SCU for studies
/modalities/{id}/find-worklistPOSTC-FIND SCU for worklist
/modalities/{id}/movePOSTTrigger C-MOVE SCU
/modalities/{id}/queryPOSTTrigger C-FIND SCU
/modalities/{id}/storage-commitmentPOSTTrigger storage commitment request
/modalities/{id}/storePOSTTrigger C-STORE SCU
/modalities/{id}/store-straightPOSTStraight C-STORE SCU
/patientsGETList the available patients
/patients/{id}GETDELETEGet information about some patient
/patients/{id}/anonymizePOSTAnonymize patient
/patients/{id}/archiveGETPOSTCreate ZIP archive
/patients/{id}/attachmentsGETList attachments
/patients/{id}/attachments/{name}GETDELETEPUTList operations on attachments
/patients/{id}/attachments/{name}/compressPOSTCompress attachment
/patients/{id}/attachments/{name}/compressed-dataGETGet attachment (no decompression)
/patients/{id}/attachments/{name}/compressed-md5GETGet MD5 of attachment on disk
/patients/{id}/attachments/{name}/compressed-sizeGETGet size of attachment on disk
/patients/{id}/attachments/{name}/dataGETGet attachment
/patients/{id}/attachments/{name}/is-compressedGETIs attachment compressed?
/patients/{id}/attachments/{name}/md5GETGet MD5 of attachment
/patients/{id}/attachments/{name}/sizeGETGet size of attachment
/patients/{id}/attachments/{name}/uncompressPOSTUncompress attachment
/patients/{id}/attachments/{name}/verify-md5POSTVerify attachment
/patients/{id}/instancesGETGet child instances
/patients/{id}/instances-tagsGETGet tags of instances
/patients/{id}/mediaGETPOSTCreate DICOMDIR media
/patients/{id}/metadataGETList metadata
/patients/{id}/metadata/{name}GETDELETEPUTGet metadata
/patients/{id}/modifyPOSTModify patient
/patients/{id}/moduleGETGet patient module
/patients/{id}/protectedGETPUTIs the patient protected against recycling?
/patients/{id}/reconstructPOSTReconstruct tags of patient
/patients/{id}/seriesGETGet child series
/patients/{id}/shared-tagsGETGet shared tags
/patients/{id}/statisticsGETGet patient statistics
/patients/{id}/studiesGETGet child studies
/peersGETList Orthanc peers
/peers/{id}GETDELETEPUTList operations on peer
/peers/{id}/configurationGETGet peer configuration
/peers/{id}/storePOSTSend to Orthanc peer
/peers/{id}/store-straightPOSTStraight store to peer
/peers/{id}/systemGETGet peer system information
/pluginsGETList plugins
/plugins/explorer.jsGETJavaScript extensions to Orthanc Explorer
/plugins/{id}GETGet plugin
/queriesGETList query/retrieve operations
/queries/{id}GETDELETEList operations on a query
/queries/{id}/answersGETList answers to a query
/queries/{id}/answers/{index}GETList operations on an answer
/queries/{id}/answers/{index}/contentGETGet one answer
/queries/{id}/answers/{index}/query-instancesPOSTQuery the child instances of an answer
/queries/{id}/answers/{index}/query-seriesPOSTQuery the child series of an answer
/queries/{id}/answers/{index}/query-studiesPOSTQuery the child studies of an answer
/queries/{id}/answers/{index}/retrievePOSTRetrieve one answer
/queries/{id}/levelGETGet level of original query
/queries/{id}/modalityGETGet modality of original query
/queries/{id}/queryGETGet original query arguments
/queries/{id}/retrievePOSTRetrieve all answers
/seriesGETList the available series
/series/{id}GETDELETEGet information about some series
/series/{id}/anonymizePOSTAnonymize series
/series/{id}/archiveGETPOSTCreate ZIP archive
/series/{id}/attachmentsGETList attachments
/series/{id}/attachments/{name}GETDELETEPUTList operations on attachments
/series/{id}/attachments/{name}/compressPOSTCompress attachment
/series/{id}/attachments/{name}/compressed-dataGETGet attachment (no decompression)
/series/{id}/attachments/{name}/compressed-md5GETGet MD5 of attachment on disk
/series/{id}/attachments/{name}/compressed-sizeGETGet size of attachment on disk
/series/{id}/attachments/{name}/dataGETGet attachment
/series/{id}/attachments/{name}/is-compressedGETIs attachment compressed?
/series/{id}/attachments/{name}/md5GETGet MD5 of attachment
/series/{id}/attachments/{name}/sizeGETGet size of attachment
/series/{id}/attachments/{name}/uncompressPOSTUncompress attachment
/series/{id}/attachments/{name}/verify-md5POSTVerify attachment
/series/{id}/instancesGETGet child instances
/series/{id}/instances-tagsGETGet tags of instances
/series/{id}/mediaGETPOSTCreate DICOMDIR media
/series/{id}/metadataGETList metadata
/series/{id}/metadata/{name}GETDELETEPUTGet metadata
/series/{id}/modifyPOSTModify series
/series/{id}/moduleGETGet series module
/series/{id}/ordered-slices(get)(deprecated) Order the slices
/series/{id}/patientGETGet parent patient
/series/{id}/reconstructPOSTReconstruct tags of series
/series/{id}/shared-tagsGETGet shared tags
/series/{id}/statisticsGETGet series statistics
/series/{id}/studyGETGet parent study
/statisticsGETGet database statistics
/storage-commitment/{id}GETGet storage commitment report
/storage-commitment/{id}/removePOSTRemove after storage commitment
/studiesGETList the available studies
/studies/{id}GETDELETEGet information about some study
/studies/{id}/anonymizePOSTAnonymize study
/studies/{id}/archiveGETPOSTCreate ZIP archive
/studies/{id}/attachmentsGETList attachments
/studies/{id}/attachments/{name}GETDELETEPUTList operations on attachments
/studies/{id}/attachments/{name}/compressPOSTCompress attachment
/studies/{id}/attachments/{name}/compressed-dataGETGet attachment (no decompression)
/studies/{id}/attachments/{name}/compressed-md5GETGet MD5 of attachment on disk
/studies/{id}/attachments/{name}/compressed-sizeGETGet size of attachment on disk
/studies/{id}/attachments/{name}/dataGETGet attachment
/studies/{id}/attachments/{name}/is-compressedGETIs attachment compressed?
/studies/{id}/attachments/{name}/md5GETGet MD5 of attachment
/studies/{id}/attachments/{name}/sizeGETGet size of attachment
/studies/{id}/attachments/{name}/uncompressPOSTUncompress attachment
/studies/{id}/attachments/{name}/verify-md5POSTVerify attachment
/studies/{id}/instancesGETGet child instances
/studies/{id}/instances-tagsGETGet tags of instances
/studies/{id}/mediaGETPOSTCreate DICOMDIR media
/studies/{id}/mergePOSTMerge study
/studies/{id}/metadataGETList metadata
/studies/{id}/metadata/{name}GETDELETEPUTGet metadata
/studies/{id}/modifyPOSTModify study
/studies/{id}/moduleGETGet study module
/studies/{id}/module-patientGETGet patient module of study
/studies/{id}/patientGETGet parent patient
/studies/{id}/reconstructPOSTReconstruct tags of study
/studies/{id}/seriesGETGet child series
/studies/{id}/shared-tagsGETGet shared tags
/studies/{id}/splitPOSTSplit study
/studies/{id}/statisticsGETGet study statistics
/systemGETGet system information
/toolsGETList operations
/tools/accepted-transfer-syntaxesGETPUTGet accepted transfer syntaxes
/tools/create-archivePOSTCreate ZIP archive
/tools/create-dicomPOSTCreate one DICOM instance
/tools/create-mediaPOSTCreate DICOMDIR media
/tools/create-media-extendedPOSTCreate DICOMDIR media
/tools/default-encodingGETPUTGet default encoding
/tools/dicom-conformanceGETGet DICOM conformance
/tools/dicom-echoPOSTTrigger C-ECHO SCU
/tools/execute-scriptPOSTExecute Lua script
/tools/findPOSTLook for local resources
/tools/generate-uidGETGenerate an identifier
/tools/invalidate-tagsPOSTInvalidate DICOM-as-JSON summaries
/tools/log-levelGETPUTGet main log level
/tools/log-level-dicomGETPUTGet log level for dicom
/tools/log-level-genericGETPUTGet log level for generic
/tools/log-level-httpGETPUTGet log level for http
/tools/log-level-jobsGETPUTGet log level for jobs
/tools/log-level-luaGETPUTGet log level for lua
/tools/log-level-pluginsGETPUTGet log level for plugins
/tools/log-level-sqliteGETPUTGet log level for sqlite
/tools/lookupPOSTLook for DICOM identifiers
/tools/metricsGETPUTAre metrics collected?
/tools/metrics-prometheusGETGet usage metrics
/tools/nowGETGet UTC time
/tools/now-localGETGet local time
/tools/reconstructPOSTReconstruct all the index
/tools/resetPOSTRestart Orthanc
/tools/shutdownPOSTShutdown Orthanc
/tools/unknown-sop-class-acceptedGETPUTIs unknown SOP class accepted?

NB: Up to Orthanc 1.8.1, this cheat sheet was manually published as anonline spreadsheet. Thisspreadsheet is still available online for history purpose, but is nowleft unmaintained.