Library Entity ============== .. code-block:: http /api/repositories/{repository}/library/entities/{libraryID} .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, The name of the :doc:`repository ` libraryID, int, The ID of the library entity .. _le_show: Get/Post ~~~~~~~~ .. http:get:: /api/repositories/(string:repository)/library/entities/(int:libraryID) :synopsis: Get the metadata for a library entity Gets the metadata for a library entity The GET request supports page and pageSize parameters on the URL. If you require a subset of this data (filtering, sorting, or columns), POST to this url with the :doc:`standard request ` body. .. code-block:: http GET /api/repositories/jupiter/library/entities/2 HTTP/1.1 Accept: application/json .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 500, Server error The response will be a :doc:`standard-response`. The ``columns`` array has three elements: .. csv-table:: :header: Human Name, Column Name, Description :widths: 25, 25, 50 Metadata, _col0, The name of the metadata statistic Value, _col1, The value of the statistic Description, _col2, A description of the statistic. The ``rows`` array has an element for each statistic available for the entity. .. code-block:: json { "rows": [ { "dataRow": [ "ID", "2", "Internal entity reference" ], "metadata": { "url": "" } }, { "dataRow": [ "Name", "LibInput", "The schema name for the library entity" ], "metadata": { "url": "" } }, { "dataRow": [ "Description", "Test Library Entity", "Business Description" ], "metadata": { "url": "" } }, { "dataRow": [ "Attributes", "1", "The number of attributes" ], "metadata": { "url": "/api/repositories/jupiter/library/entities/2/attributes" } }, { "dataRow": [ "Business Rules", "2", "The number of business rules defined for this library" ], "metadata": { "url": "/api/repositories/jupiter/library/entities/2/businessrules" } }, { "dataRow": [ "Created By", "bob", "User who created the library" ], "metadata": { "url": "" } }, { "dataRow": [ "Date Created", "2014/11/06 12:25:12", "When the library was created" ], "metadata": { "url": "" } }, { "dataRow": [ "Edited By", "bob", "The user who last edited the library" ], "metadata": { "url": "" } }, { "dataRow": [ "Edited Date", "2014/11/13 11:55:02", "When the library was last edited" ], "metadata": { "url": "" } } ] } The metadata shown in the sample response could be represented as follows: .. csv-table:: :header: Metadata, Value, Description :widths: 20, 30, 50 "ID", "2", "Internal entity reference" "Name", "LibInput", "The schema name for the library entity" "Description", "Test Library Entity", "Business Description" "Attributes", "1", "The number of attributes" "Business Rules", "2", "The number of business rules defined for this library" "Created By", "bob", "User who created the library" "Date Created", "2014/11/06 12:25:12", "When the library was created" "Edited By", "bob", "The user who last edited the library" "Edited Date", "2014/11/13 11:55:02", "When the library was last edited" Commands ~~~~~~~~ .. http:post:: /api/repositories/(string:repository)/library/entities/(int:libraryID) :synopsis: Edit, associate or disassociate library entity Edit, associate or disassociate a library entity :jsonparam body: The request body .. code-block:: http POST /api/repositories/jupiter/library/entities/2 HTTP/1.1 Content-Type: application/json { "command": "edit", "data": { "name": "Just one more change", "description": "It's wafer thin..." } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, No error 400, Invalid request body 400, Invalid command 400, Invalid data passed with request 400, Error converting data to Tcl List 500, Server error The request requires a :doc:`standard-request` packet. Available commands are: .. csv-table:: :header: Command, Description :widths: 30, 70 edit, Edit a business rule disassociate, Disassociate a library entity from one or more real entities associate, Associate a library entity from one or more real entities promote, Promote rules from a real entity to a library entity import, Import one or more library entity business rules export, Export one or more library entities The request packet must contain the ``command`` and ``data`` elements. The ``options`` element is not required. See the :doc:`libraryentity-commands` for the contents of the request for each command. .. _le_delete: Delete ~~~~~~ .. http:delete:: /api/repositories/(string:repository)/library/entities/(int:libraryID) :synopsis: Delete a library entity Delete a library entity :jsonparam body: The request body (optional) .. code-block:: http DELETE /api/repositories/jupiter/library/entities/2 HTTP/1.1 Content-Type: application/json { "disassociate": ["2 1", "2 4"] } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, No error A delete request may have a body containing key-value pair identifying which entities are to be disassociated before the library entity is deleted. The value is an array; each element is a string containing the library entity ID and the entity ID to disassociate. If a library entity is deleted without disassociating the entities, the business rules in each entity will also be deleted. If the entities are disassociated, the business rules will not be deleted from the entities. A list of entities that are associated with a library entity can be obtained using the :doc:`libraryentityassociatedentities` endpoint.