Duplicate Keys ============== .. code-block:: http /api/repositories/{repository}/entities/{entity}/rows/duplicatekeys .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, the name of the :doc:`repository` entity, int, The ID of the entity to view .. http:post:: /api/repositories/(string:repository)/entities/(int:entity)/rows/duplicatekeys :synopsis: Lists duplicate keys in a real entity Lists duplicate keys in a real :doc:`entity` :jsonparam body: The request body .. code-block:: http POST /api/repositories/jupiter/entities/1/rows/duplicatekeys HTTP/1.1 Content-Type: application/json { "command": "get", "attribute": ["Key", "Data1"], "values": ["333", "CCC"] } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 400, Invalid data passed with request 500, Server error The request requires a :doc:`standard-request` packet. The request packet must contain the ``attribute`` and ``values`` elements. ``attribute`` element should contain an array of all the attribute names for the duplicate keys. The ``values`` field should contain an array of values corresponding to each duplicate key. The response will be a :doc:`standard-response`, with a list of duplicate rows in the corresponding :doc:`entity` that matches the parameters passed. The ``columns`` array will contain the list of columns for each data row. The first element is :row ID:. The remaining elements are the :doc:`attributes` of the entity. data row will contain the list of permanent duplicate keys of the corresponding :doc:`entity`: .. code-block:: json "rows": [ { "dataRow": [ "4", "333", "CCC" ], "metadata": { "url": "/api/repositories/jupiter/entities/24/rows/4/details" } }, { "dataRow": [ "5", "333", "CCC" ], "metadata": { "url": "/api/repositories/jupiter/entities/24/rows/5/details" } }, { "dataRow": [ "6", "333", "CCC" ], "metadata": { "url": "/api/repositories/jupiter/entities/24/rows/6/details" } } ] If there are no permanent duplicate keys in the :doc:`entity`, ``rows`` will be an empty string. Export ~~~~~~~ Some or all of the rows may be exported as a scheduled task. .. code-block:: http POST /api/repositories/jupiter/entities/1/rows/duplicatekeys HTTP/1.1 Content-Type: application/json { "command": "export", "attribute": ["Key", "Data1"], "values": ["333", "CCC"], "data": { "filename": "filename.csv", "filetype": "csv", "encoding": "utf-8" }, "options": { "where": "Row = 21" } } .. 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" }