Home > Class Reference > ENSLIB namespace > %Api.Atelier.v1

%Api.Atelier.v1

class %Api.Atelier.v1 extends %Atelier.REST

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

Method Inventory (Including Private)

Parameters

parameter DELIMITER;
The delimiter string used by ##class(%Studio.Debugger).GetInfo

Methods (Including Private)

classmethod Compile(pNamespace As %String) as %Status
This method permits the compilation of more than one document at a time.
The method expects a content body to be encoded in JSON and contain an
array of items (document names) to be compiled.

HTTP Codes returned:-

HTTP 200 if OK
HTTP 400 if the resource name is an invalid document name
HTTP 404 if the resource is not found
HTTP 423 if the document is locked
HTTP 500 if an error occurs (details will be in status error array)

Return content will be an array of document objects.
Errors pertaining to the document will be in the status property of the document object.

The URL parameter 'flags' can be passed (default 'cuk') which will be passed to the compiler.
The URL parameter 'source' can be passed with a value of 0 if you don't want the source of the
compiled document to be returned.

POSTED: ["Atelier.NewClass1.cls"]

Example Output :-
{
  "status": {
    "errors": [],
    "summary": ""
  },
  "console": [
    "Compilation started on 01/12/2016 17:44:00 with qualifiers 'cuk'",
    "Compiling class Atelier.NewClass1",
    "Compiling table Atelier.NewClass1",
    "Compiling routine Atelier.NewClass1.1",
    "Compilation finished successfully in 0.067s.",
    ""
  ],
  "result": {
    "content": [
      {
        "name": "Atelier.NewClass1.cls",
        "status": "",
        "content": [
          "Storage Default",
          "{",
          "",
          "",
          "%%CLASSNAME",
          "",
          "",
          "^Atelier.NewClass1D",
          "NewClass1DefaultData",
          "^Atelier.NewClass1D",
          "^Atelier.NewClass1I",
          "^Atelier.NewClass1S",
          "%Library.CacheStorage",
          "}",
          ""
        ],
        "db": "CACHESYS",
        "ts": "2016-01-12 17:44:00.053",
        "enc": false
      }
    ]
  }
}
classmethod CreateSourceControlClass() as %Status
Determine the source control class and get an instance of it. The instance is stored in
the public variable %SourceControl and is used by various system utilities.
classmethod CvtClientDocToXml(pNamespace As %String) as %Status
This method converts a client Doc to the corresponding XML.
Note: This is NOT a public API and will be retired in a future version
Customers SHOULD NOT call this API from their own code

HTTP Codes returned:-

HTTP 200 if OK
HTTP 400 if the posted content is empty
HTTP 415 if content type is not application/json
HTTP 500 if an error occurs (details will be in status error array)

Returned content is XML.
classmethod CvtXmlToClientDoc(pNamespace As %String) as %Status
This method converts a XML to the corresponding client document format.
Note: This is NOT a public API and will be retired in a later version
Customers SHOULD NOT call this API from their own code

HTTP Codes returned:-

HTTP 200 if OK
HTTP 400 if the posted content is empty
HTTP 415 if content type is not application/xml
HTTP 500 if an error occurs (details will be in status error array)

Returned content is plain text.
classmethod DeleteDoc(pNamespace As %String, pDocName As %String) as %Status
This method deletes the named document in the specified namespace

HTTP Codes returned:-

HTTP 200 if OK
HTTP 400 if the resource name is an invalid document name
HTTP 404 if the resource is not found
HTTP 423 if the resource is locked
HTTP 500 if an error occurs (details will be in status error array)

Return content will be a document object.
errors pertaining to the document will be in the status property of the document object

Example Output :-
{
  "status": {
    "errors": [],
    "summary": ""
  },
  "console": [
  ],
  "result": {
    "name": "xyz.mac",
    "db": "CACHESYS",
    "ts": "",
    "cat": "RTN",
    "status": "",
    "enc": false,
    "content": []
  }
}
classmethod DeleteDocs(pNamespace As %String) as %Status
This method deletes the list of named documents which is passed in the body of the http request.
as a JSON array [ "%Activate.Enum.cls", ... ]

HTTP Codes returned:-

HTTP 200 if OK
HTTP 400 if the posted data does not contain a JSON array
HTTP 415 if the we are not passed application/json as the content type
HTTP 500 if an error occurs (details will be in status error array)

Return content will be an array of document objects. Errors pertaining to a each document
will be in the status property of each document object. If the status is an empty string then
the document was deleted successfully. Otherwise the document was NOT deleted. For deleted docs
the db entry will indicate from which database the doc was deleted.

POSTED: ["xyz.mac","notexist.cls"]

Result :-
{
  "status": {
    "errors": [],
    "summary": ""
  },
  "console": [
  ],
  "result": [
    {
      "name": "xyz.mac",
      "db": "",
      "status": ""
    },
    {
      "name": "notexist.cls",
      "db": "",
      "status": "ERROR #5001: Document Does Not Exist: User.notexist.cls [zExistsDoc+3^%Atelier.v1.Utils.General.1:%SYS]"
    }
  ]
}
classmethod GetAdpInputOutputClass(pNamespace As %String = "", pAdpName As %String = "") as %Status
This method returns the input and output type for the adapter.

HTTP Codes returned:-

HTTP 200 if OK
HTTP 404 if the adapter does not exist
HTTP 500 if an error occurs (details will be in status error array)

Example response:
{
  status: {
    errors: []
    summary: ""
  }
  console: []
  result: {
    content: {
      input: "%Stream.Object"
      output: "%String"
    }
  }
}
classmethod GetCSPApps(pNamespace As %String = "") as %Status
This method returns a list csp apps defined on the server (or namespace)

GET http://localhost:57772/api/atelier/v1/%25SYS/cspapps
GET http://localhost:57772/api/atelier/v1/%25SYS/cspapps/DOCBOOK

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 csp application descriptors.
{
  "status": {
    "errors": [],
    "summary": ""
  },
  "console": [],
  "result": {
    "content": [
      "/csp/broker",
      "/csp/docbook",
      "/csp/documatic",
      "/csp/samples",
      "/csp/samples/docserver",
      "/csp/sys",
      "/csp/sys/bi",
      "/csp/sys/exp",
      "/csp/sys/mgr",
      "/csp/sys/op",
      "/csp/sys/sec",
      "/csp/user",
      "/isc/pki",
      "/isc/studio/rules",
      "/isc/studio/templates",
      "/isc/studio/usertemplates"
    ]
  }
}


passing the URL parameter ?detail=1 will return an array containing objects which describe
the application in more detail :-
{
  "status": {
    "errors": [],
    "summary": ""
  },
  "console": [],
  "result": {
    "content": [
      {
        "default": false,
        "name": "/csp/broker"
      },
      {
        "default": true,
        "name": "/csp/sys"
      },
      {
        "default": false,
        "name": "/csp/sys/bi"
      },
      {
        "default": false,
        "name": "/csp/sys/exp"
      },
      {
        "default": false,
        "name": "/csp/sys/mgr"
      },
      {
        "default": false,
        "name": "/csp/sys/op"
      },
      {
        "default": false,
        "name": "/csp/sys/sec"
      },
      {
        "default": false,
        "name": "/isc/pki"
      },
      {
        "default": false,
        "name": "/isc/studio/rules"
      },
      {
        "default": false,
        "name": "/isc/studio/templates"
      },
      {
        "default": false,
        "name": "/isc/studio/usertemplates"
      }
    ]
  }
}
classmethod GetDoc(pNamespace As %String, pDocName As %String) as %Status
This method returns the text for the named document and namespace.

HTTP Codes returned:-

HTTP 200 if OK
HTTP 304 if the document has not been modified (see https://en.wikipedia.org/wiki/HTTP_ETag)
HTTP 400 if the named resource is not a valid document name
HTTP 404 if the document does not exist
HTTP 500 if an unxpected error occurs (details will be in status error array)

Return content will contain a document object.
Errors pertaining to the document will be in the status property of the document object. If source control hooks are enabled for the namespace any console output generated by the hook will be captured and returned as an array of lines in the 'console' array.

The result contains the name of the requested file, the database where it is stored, its timestamp and category (CLS - class, RTN -routine, CSP - csp file, OTH - other), as well as the document contents which are returned in an array.

For text files this will be an array of strings and the 'enc' json field will be set to false.
For binary files this will be an array of base64 encoded chunks and the 'enc' field will be set to true.

The URL parameter ?binary=1 can be passed to force the document to be encoded as binary.

The URL parameter ?storageOnly=1 can be passed to return only the storage portion of a class.

If a 'soft' error occurs such as a 'document does not exist', additional information can be found in the 'status' field of the result. Examples of other soft errors are 'file is locked' etc.

Here is an example of the result of asking for %Activate.Enum.cls
{
  "status": {
    "errors": [],
    "summary": ""
  },
  "console": [],
  "result": {
    "name": "%Activate.Enum.cls",
    "db": "CACHELIB",
    "ts": "2016-01-04 14:00:04.000",
    "cat": "CLS",
    "status": "",
    "enc": false,
    "content": [
      "/// This class is the superclass for all enumerated types generated from",
      "/// a type library",
      "Class %Activate.Enum Extends %Integer [ Not ProcedureBlock, System = 3 ]",
      "{",
      "",
      "}",
      ""
    ]
  }
}


and here is the result with ?binary=1
{
  "status": {
    "errors": [],
    "summary": ""
  },
  "console": [],
  "result": {
    "name": "%Activate.Enum.cls",
    "db": "CACHELIB",
    "ts": "2016-01-04 14:00:04.000",
    "cat": "CLS",
    "status": "",
    "enc": true,
    "content": [
      "Ly8vIFRoaXMgY2xhc3MgaXMgdGhlIHN1cGVyY2xhc3MgZm9yIGFsbCBlbnVtZXJhdGVkIHR5cGVzIGdlbmVyYXRlZCBmcm9tCi8vLyBhIHR5cGUgbGlicmFyeQpDbGFzcyAlQWN0aXZhdGUuRW51bSBFeHRlbmRzICVJbnRlZ2VyIFsgTm90IFByb2NlZHVyZUJsb2NrLCBTeXN0ZW0gPSAzIF0KewoKfQo="
    ]
  }
}
classmethod GetDocNames(pNamespace As %String, pCat, pType)
This method returns a list of document names. Cat and Type constrain the types of documents,
whilst the URL parameter 'generated' determines whether generated documents should be included
and the 'filter' parameter provides a SQL filter that can be used to match the names.

HTTP Codes returned:-

HTTP 200 if OK
HTTP 500 if an error occurs (details will be in status error array)

Return content will be an array of document descriptors :-
{
    "status": {
        "errors": [],
        "summary": ""
    },
    "console": [],
    "result": {
        "content": [{
            "name": "%Activate.Enum.cls",
            "cat": "CLS",
            "ts": "2016-01-04 14:00:04.000",
            "db": "CACHELIB",
            "gen": false
        }]
    }
}
classmethod GetDocs(pNamespace As %String) as %Status
This method returns the text for the all the specified documents in the namespace.
A list of documents to be fetched is passed in the body of the http request.
The request body is simply a JSON array