Attribute Masks =============== .. code-block:: http /api/repositories/{repository}/entities/{entity}/attributes/{attribute}/masks .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, The :doc:`repository ` name entity, int, The :doc:`entity ` ID attribute, int, The :doc:`attribute ` ID Only POST requests are supported for this endpoint. .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/attributes/(int:attributeID)/masks :synopsis: Get a partial list of masks for an attribute Get a page of masks for an attribute .. code-block:: http POST /api/repositories/jupiter/entities/1/attributes/55/masks HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "pageStart": 1, "pageSize": 32 } } The response is a :doc:`standard-response`. The ``columns`` array will show the following columns: .. csv-table:: :header: Human Name, Column Name, Description :widths: 25, 25, 50 "Mask", "VALUE", "The mask of the data" "Mask Stats", "_mask_stat", "The pattern of the mask" "Value Count", "VALUE_COUNT", "The number of values that match the mask" "Frequency", "FREQUENCY_COUNT", "The frequency of all the values that match the mask." "Dist %", "_distribution", "A measure of how much of the attribute contains values that match the mask" A ``datarow`` element will look like: .. code-block:: json { "dataRow": [ "NNNNNNNNNN", "N10", "43", "574", "40.508" ] } Export ~~~~~~~ Some or all of the rows may be exported as a scheduled task. .. code-block:: http POST /api/repositories/jupiter/entities/1/attributes/2/masks HTTP/1.1 Content-Type: application/json { "command": "export", "data": { "filename": "filename.csv", "filetype": "csv", "encoding": "utf-8" }, "options": { "where": "Frequency = 3" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 400, Invalid data passed with request 500, Server error The request packet must contain the ``command`` and ``data`` elements. The ``options`` element is not required, but may specify the columns to export, and/or the rows to filter. The following table shows which fields are required in the ``data`` element: .. csv-table:: :header: Field, Required :widths: 20, 10 filename, Y filetype, N encoding, N If ``filetype`` is not specified, it defaults to csv. If ``encoding`` is not specified, it defaults to the server native encoding. The response will contain the URL of the scheduled task and the link to download the exported file. .. code-block:: json { "job": "/api/repositories/jupiter/scheduler/1", "file": "/api/repositories/jupiter/download/filename.csv" } .. _masks_recode: Recode Masks ~~~~~~~~~~~~ Edit ---- .. code-block:: http /api/repositories/{repository}/entities/{entity}/attributes/{attribute}/recodemasks .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, The :doc:`repository ` name entity, int, The :doc:`entity ` ID attribute, int, The :doc:`attribute ` ID .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/attributes/(int:attributeID)/recodemasks :synopsis: Recode masks of an attribute Recode masks for an attribute .. code-block:: http POST /api/repositories/jupiter/entities/1/attributes/55/recodemasks HTTP/1.1 Content-Type: application/json { "command": "edit", "data": "AANNNNN AANN ANNNNN ANN" } data is a list of " ................." data should contain a list of "Mask and Recoding Mask" pairs. In the above example AANNNNN is the mask and AANN is the recoding mask. AANNNNN will be recoded to AANN All fields are required. .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success 500, Server error If the recode is successful, the response will contain a URL pointing at the masks of the attribute. Export ------ .. code-block:: http /api/repositories/{repository}/entities/{entity}/attributes/{attribute}/recodemasks .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, The :doc:`repository ` name entity, int, The :doc:`entity ` ID attribute, int, The :doc:`attribute ` ID .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/attributes/(int:attributeID)/recodemasks :synopsis: Export recode masks of an attribute Export recode masks of an attribute .. code-block:: http POST /api/repositories/jupiter/entities/1/attributes/55/recodemasks HTTP/1.1 Content-Type: application/json { "command": "export", "data": { "filename": "filename", "encoding": "ascii", "fieldWidth":"AUTO" } } All fields are required. ``filename`` enter the filename, the ddx will be created with the same filename but with .ddx extention. ``encoding`` field indicates the character encoding used by the data file. The following are the supported encodings: ``cp1252, ascii, big5, cp1250, cp1251, cp1253, cp1254, cp1255, cp1256, cp1257, cp1258, cp437, cp737, cp775, cp850, cp852, cp855, cp857, cp860, cp861, cp862, cp863, cp864, cp865, cp866, cp869, cp874, cp932, cp936, cp949, cp950, dingbats, ebcdic, euc-cn, euc-jp, euc-kr, gb12345, gb1988, gb2312, gb2312-raw, identity, iso2022, iso2022-jp, iso2022-kr, iso8859-1, iso8859-10, iso8859-13, iso8859-14, iso8859-15, iso8859-16, iso8859-2, iso8859-3 iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, iso8859-9, jis0201, jis0208, jis0212, koi8-r, koi8-u, ksc5601, macCentEuro, macCroatian macCyrillic, macDingbats, macGreek, macIceland, macJapan, macRoman, macRomania, macThai, macTurkish, macUkraine, shiftjis, symbol, tis-620, unicode, utf-8`` ``fieldWidth`` should either be set to "AUTO" or to a value between 0 and 100. .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success 500, Server error If the export is successful, the response will as follows, containing URL pointing to an export job and URL links to download the created files. .. code-block:: http { "job": "/api/repositories/jupiter/scheduler/107", "file": "/api/repositories/jupiter/download/filename", "ddxFile": "/api/repositories/jupiter/download/filename.ddx" }