Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/records/shallow_copy

Requires JWT.

Copy a record without its subtree.

If the title of the copy exists under the parent, we update it to indicate we've made a copy.

The place where the record is inserted is determined by before_record, which should be a child of the parent. If before_record is given, the record is placed before that record, and all subsequent siblings are placed accordingly. If before_record is not given, this means that the record should be the last child of the parent (consistent with create_record). This also works if the parent is currently empty.

Request

POST /api/p/<project gid>/records/shallow_copy
Authorization: Bearer <JWT>

{
    "record": "f2e64fe0-9ffa-4d9a-8750-d561d6542453",
    "parent": "9c5e1c75-6b81-44e1-a3fc-1b41ec9ba58b",
    "before_record": "e1c3e5cb-2a98-434c-87e3-b14e95e94a1b",
    "ordering": "87b53a4e-359d-45c7-81cb-5e1c3ef444ec"
}

record gid for the record we are copying.
parent is the parent gid for the copied record and must exist.
ordering the current ordering.

optional

before_record is the gid for the next sibling; the copied record is placed before this one in the current ordering. If it isn't given, the record is placed last.
language return data for this (project) language.
languages return data for these (project) languages.

If you request language and/or languages, you get the records' title and fields for the combined set. If you request neither, you'll get all available languages.

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "record": "7c136ddb-4dfa-4ec1-bad4-15067cbf80d9",
        "parent": "9c5e1c75-6b81-44e1-a3fc-1b41ec9ba58b"
    },
    "data": {
        "records": {
            "7c136ddb-4dfa-4ec1-bad4-15067cbf80d9": {
                
            },
            "9c5e1c75-6b81-44e1-a3fc-1b41ec9ba58b": {
                
            }
        }
    }
}

result

record the newly created copy.
parent the parent of the new record.

data

records Record info with hierarchy, definition, field values. Unordered.

Error responses

400 Bad request - missing parameters or wrong type or value
401 Unauthorized - missing or expired JWT
403 Forbidden - not a member of this project
422 Unprocessable entity - parent record doesn't exist