%Api.Atelier.v6
Class %Api.Atelier.v6 Extends %Api.Atelier.v5
%Api.Atelier.v6 provides version 6 APIs for Atelier
XDatas
UrlMap
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
Methods
Query
ClassMethod Query(pNamespace As %String) As %Status
This method returns the results of running the specified query in the specified namespace.
The request body is simply a JSON object which specifies the query:
{ "query": "SELECT TOP 1 Name FROM %Dictionary.ClassDefinition", "parameters" : [] }
The URL parameter ?max= can be passed to specify the maximum number of rows to return. The value must be a positive integer or the default behavior (return all rows) will be used.
HTTP Codes returned:-
HTTP 200 if OK
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)
If the URL parameter ?positional=1 is passed, the return object key will contain an array of objects, one for each result set, that contains the column metadata and the values for each row in separate arrays:
{ "status": { "errors": [], "summary": "" }, "console": [], "result": [ { "columns": [ { "name": "Name", "type": "VARCHAR(4096)" } ], "content": [ [ "%Api.Atelier" ] ] } ] }
If the positional URL parameter is not passed or the value is not 1, the return content will be an array of objects.
The objects contain information relating to each row returned by the query:
{ "status": { "errors": [], "summary": "" }, "console": [], "result": { "content": [ { "Name": "%Api.Atelier" } ] } }
AppendResultSet
ClassMethod AppendResultSet(pArray As %DynamicArray, pResult As %SQL.StatementResult, pMax As %Integer = -1, pPositional As %Boolean = 0) As %Status [ Internal, Private ]
Helper method for Query Appends result set (%SQL.StatementResult) to an array. Largely copied from %DataModel.Document.Server.SQL.Query If pMax is -1 (the default), return all rows. Else, returns pMax rows. If pPositional is 1, create an object with column metadata and the values for each row returned as an array. Else (the default), use the same return format as versions 1-5.
QueueAsync
ClassMethod QueueAsync(pNameSpace As %String) As %Status [ Internal ]
This call queues an item for work. On success it returns 202 and sets the 'Location' header
to indicate where the results can be retrieved from with an HTTP GET.
HTTP Codes returned:-
HTTP 202 if Accepted
HTTP 404 if the request type does not exist
HTTP 500 if an error occurs (details will be in status error array)
PollAsync
ClassMethod PollAsync(pNameSpace As %String, pID As %Integer) As %Status [ Internal ]
This call polls a queued item for console output and results. On success it returns 200.
Console output and results are found in the standard locations for Atelier REST APIs.
If there is more output expected the server will set the 'Retry-After' header. The client
should read this header to determine if another call should be made.
When the result of processing is available (or the work is finished) a GET to this API
will return any results in the 'content' field and (crucially) will NOT set the 'Retry-After'
header. This is an indication that processing is finished.
HTTP Codes returned:-
HTTP 200 if Accepted
HTTP 404 if the request ID does not exist
HTTP 423 if the global node is locked
HTTP 500 if an error occurs (details will be in status error array)
CancelAsync
ClassMethod CancelAsync(pNameSpace As %String, pID As %Integer) As %Status [ Internal ]
This call cancels a work request that has been previously queued.
HTTP Codes returned:-
HTTP 200 if Cancelled
HTTP 404 if the request ID does not exist
HTTP 423 if the global node is locked
HTTP 500 if an error occurs (details will be in status error array)
SearchOutputToJSON
ClassMethod SearchOutputToJSON(pMsgArray As %DynamicArray, ByRef pResult As %DynamicArray) As %Status [ Internal, Private ]
Convert find in files console output into a JSON array. Extracted from the end of %Api.Atelier.v2::Search().
ExecuteAsyncRequest
ClassMethod ExecuteAsyncRequest(pID As %Integer) [ Internal ]
This is a background job that monitors the queue for work to do
AsyncRequestBeginCapture
ClassMethod AsyncRequestBeginCapture(pID As %Integer, Output pCookie As %String) As %Status [ Internal, ProcedureBlock = 0 ]
AsyncRequestEndCapture
ClassMethod AsyncRequestEndCapture(pCookie As %String) As %Status [ Internal ]
PurgeAsyncQueue
ClassMethod PurgeAsyncQueue() As %Status [ Internal ]
Purge the ^IRIS.TempAtelierAsyncQueue global of any request data that is over a day old. Theoretically there should be nothing to clean up but this is needed in case some error occurs and request data is left behind.