Skip to main content

%Api.DocDB.v1

Class %Api.DocDB.v1 Extends %DocDB.REST

%Api.DocDB.v1 provides version 1 APIs for DocDB

Http/Rest Calls

APIURIHTTP MethodContentDescriptionRole/Permission
GetAllDatabases/namespaceNameGETnoneReturn the name of each Database defined in the namespaceName Namespace.%DocDB_Admin/USE
DropAllDatabases/namespaceNameDELETEnoneDelete all of the databases defined in the namespaceName namespace.%DocDB_Admin/USE
CreateDatabase/namespaceName/db/databaseName ?type= documentType& resource= databaseResourcePOSTnoneCreate a new Database in the namespaceName namespace.%DocDB_Admin/USE
DropDatabase/namespaceName/db/ databaseNameDELETEnoneDrop the databaseName database from namespaceName namespace.%DocDB_Admin/USE
GetDatabase/namespaceName/db/ databaseNameGETnoneReturn the databaseName database definition. This function is also sufficient for DatabaseExists.defined resource/USE
CreateProperty/namespaceName/ prop/databaseName/ propertyName?type= propertyType& path= propertyPath& unique=propertyUniquePOSTnoneCreate a new property or replace an existing property in databaseName. The property is defined by URL parameters and not Content. All parameters are optional.%DocDB_Admin/USE
DropProperty/namespaceName/prop/ databaseName /propertyNameDELETEnoneRemove a property definition from databaseName.%DocDB_Admin/USE
GetProperty/namespaceName/prop/ databaseName/ propertyNameGETnoneReturn the property definition from databaseName.defined resource/USE
SaveDocument/namespaceName/doc/databaseName/POSTJSON object or arrayInsert a new document into databaseName.defined resource/WRITE
SaveDocument/namespaceName/doc/ databaseName/idPUTJSON object or arrayReplace an existing document in databaseName.defined resource/WRITE
SaveDocumentByKey/namespaceName/doc/ databaseName/keyPropertyName/keyValuePUTJSON object or arrayReplace an existing document in databaseName.defined resource/WRITE
DeleteDocument/namespaceName/doc/ databaseName/idDELETEnoneDelete the document from the database.defined resource/WRITE
DeleteDocumentByKey/namespaceName/doc/ databaseName/keyPropertyName/keyValueDELETEnoneDelete the document from the database.defined resource/WRITE
FindDocuments/namespaceName/ find/databaseName? wrapped=true|falsePOSTJSON objectFind all documents in databaseName matching the query specification.defined resource/USE
GetDocument/namespaceName/doc/ databaseName/id? wrapped=true|falseGETnoneReturn the requested document.defined resource/READ
GetDocumentByKey/namespaceName/doc/ databaseName /keyPropertyName /keyValuePOSTNoneRetrieve a document by a property defined as a unique key.defined resource/READ

Parameters

CHARSET

Parameter CHARSET = "utf-8";

Specifies the default character set for the page. This can be overriden using the <CSP:CONTENT CHARSET=> tag, or by setting the %response.CharSet property in the OnPreHTTP method. If this parameter is not specified, then for the default charset is utf-8.

CONVERTINPUTSTREAM

Parameter CONVERTINPUTSTREAM = 1;

Specifies if input %request.Content or %request.MimeData values are converted from their original character set on input. By default (0) we do not modify these and receive them as a binary stream which may need to be converted manually later. If 1 then if there is a 'charset' value in the request Content-Type or mime section we will convert from this charset when the input data is text based. For either json or xml data with no charset this will convert from utf-8 or honor the BOM if one is present.

CONTENTTYPE

Parameter CONTENTTYPE = "application/json";

Specifies the default content type for the page. This can be overriden using the <CSP:CONTENT TYPE=> tag, or by setting the %response.ContentType property in the OnPreHTTP method. The default value if this parameter is not set is text/html.

HandleCorsRequest

Parameter HandleCorsRequest = 1;

This parameter influences the CORS support. The default is an empty string meaning 'not specified'. If set to true (1) then CORS processing is ON. If set to false (0) then CORS processing is OFF. If left unset "" then the decision to process CORS is delegated to the setting on the URL map route.

UseSession

Parameter UseSession As Integer = 1;

This parameter controls the CSP session support. By default the CSP session will be ended after each request in accordance with the spirit of REST. However this CAN be overridden by the user. To use a session, it's necessary to manage the CSPSESSION cookie. Browsers do this automatically but command line tools such as CURL require the setting of options.

Note that if you choose to use a session then this will use a CSP license until the session is ended or expires and the grace period has been satisfied. If you use the default of no session then this will be the same behavior as SOAP requests of holding a license for ten seconds.

XDatas

UrlMap

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]

Methods

httpPostServer

ClassMethod httpPostServer() As %Status

This method returns a list of namespaces for this server HTTP Codes returned:- HTTP 200 if OK HTTP 500 if an error occurs (details will be in status error array) returned content is an array of namespaces

httpGetNamespace

ClassMethod httpGetNamespace(namespaceName As %String(MAXLEN="")) As %Status

httpDeleteNamespace

ClassMethod httpDeleteNamespace(namespaceName As %String(MAXLEN="")) As %Status

httpDeleteDatabase

ClassMethod httpDeleteDatabase(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN="")) As %Status

httpGetDatabase

ClassMethod httpGetDatabase(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN="")) As %Status

httpPostDatabase

ClassMethod httpPostDatabase(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN="")) As %Status

httpDeleteProperty

ClassMethod httpDeleteProperty(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), propertyName As %String(MAXLEN="")) As %Status

httpGetProperty

ClassMethod httpGetProperty(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), propertyName As %String(MAXLEN="")) As %Status

httpPostProperty

ClassMethod httpPostProperty(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), propertyName As %String(MAXLEN="")) As %Status

httpDeleteDocument

ClassMethod httpDeleteDocument(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), documentID As %String(MAXLEN="")) As %Status

httpDeleteDocumentByKey

ClassMethod httpDeleteDocumentByKey(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), keyName As %String(MAXLEN=""), keyValue As %String(MAXLEN="")) As %Status

httpGetDocument

ClassMethod httpGetDocument(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), documentID As %String(MAXLEN="")) As %Status

httpGetDocumentByKey

ClassMethod httpGetDocumentByKey(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), keyName As %String(MAXLEN=""), keyValue As %String(MAXLEN="")) As %Status

httpPutDocument

ClassMethod httpPutDocument(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), documentID As %String(MAXLEN="")) As %Status

httpPutDocumentByKey

ClassMethod httpPutDocumentByKey(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN=""), keyName As %String(MAXLEN=""), keyValue As %String(MAXLEN="")) As %Status

httpPostDocument

ClassMethod httpPostDocument(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN="")) As %Status

httpPostFind

ClassMethod httpPostFind(namespaceName As %String(MAXLEN=""), databaseName As %String(MAXLEN="")) As %Status