This provide some of the basic specification and explaination on how to use iGarment. iGarment API following the standard of Restful API via HTTPS.
Currently, our API supported Creating, Retrieving, Updating, and Deletion (CRUD) operation of the following documents.
The following are list of utilities API to partially update a document
Upon defining the JSON schema for the above documents, we will use the following list of objects in each document's schema.
object_party is a list of object to define communication party.
object_document is list of objects commonly used in a document.
object_styles is a list of objects to define a product, its variances and assortments.
URL: ~/jdoc/<document_type>[<document_ref>][?<query_parameter>]
<document_type> refer to the target type of document.
<document_ref> a path liked document reference to identify the document. Note that operation like POST (or Create) does not need to provide a document reference.
?<query_parameter> an optional query parameters to find documents. Its return is a list of document reference number instead of the document itself.
The following URL refer to an API targeting to a Purchase Order which its reference number is 12345.
~/jdoc/purchase_order/12345
In most case, reference to a document require a single number. But there are document may have mutli-parts reference number, like Work Order. In this case, the document reference number is a path like data as in the following example
~/jdoc/worker_order/12345/1
One will need to provide a reference number for the PUT and DELETE operation.
For GET method, you may ask for a specific document by providing a document reference number. In this case, the request document will be return.
You may also use the GET method to query for a list of documents by using a find expression parameters. The return will be an array of document reference where each reference is also a path like document reference.
It is invalid if an URL contains a document reference and a query parameter.
Our syntax of find expression is borrow from MongoDB except we can only find documents by using the scalar attributes of each document. Scalar attributes are the first and second level of object attributes which are not an array nor in an array.
The query expression is fairly strict forward. May be better to present by example.
The design of the query expression is make it URL friendly. String does not need to be quoted. But you do need to escape special characters when neccessary.
$eq(attribute,value)
~/jdoc/purchase_order?q=$eq(iss_date,2022-09-22)
$ne(attribute,value)
~/jdoc/purchase_order?q=$and($ge(iss_date,2022-09-22),$ne(doc_status,I))
$gt(attribute,value)
~/jdoc/purchase_order?q=$gt(iss_date,2022-09-22)
$ge(attribute,value)
~/jdoc/purchase_order?q=$ge(iss_date,2022-09-22)
$lt(attribute,value)
~/jdoc/purchase_order?q=$and($ge(iss_date,2022-09-22),$lt(iss_date,2022-10-1))
$le(attribute,value)
~/jdoc/purchase_order?q=$and($ge(iss_date,2022-09-22),$le(iss_date,2022-09-30))
$like(attribute,value)
~/jdoc/purchase_order?q=$like(pu_order_no,nettest)
~/jdoc/purchase_order?q=$like(pu_order_no,nettest%25)
$and(expr, expr, ...)
~/jdoc/purchase_order?q=$and($ge(iss_date,2022-09-22),$eq(doc_status,I))
$or(expr, expr, ...)
~/jdoc/purchase_order?q=$or($gt(iss_date,2022-09-22),$eq(iss_date,2022-09-22))