Skip to content

API Walkthroughs 5.1 Court to Prison move with PNC PN

Martyn Whitwell edited this page Jul 28, 2020 · 1 revision

Moves API Walkthrough

5. Court to Prison/STC/SCH prison_remand moves

5.1 Move for a person with a PNC/PN identifier from Court to Prison on a specific move date

  1. Get the existing person record(s) by searching by prison number or police national computer number. Note how related objects can be returned by adding an ?include parameter:

    curl --request GET \
      --url 'http://server/api/people?filter%5Bprison_number%5D=G8133UA&include=profiles' \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX'

    or, to search by police national computer number:

    curl --request GET \
      --url 'http://server/api/people?filter%5Bpolice_national_computer%5D=14%2F120018R&include=profiles' \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX'

    This method will return a list of matching person records. Where there are multiple records, review them and select the most appropriate one.

    {
      "data": [
        {
          "id": "747f3914-620a-441a-847f-472c79def26c",
          "type": "people",
          "attributes": {
            "first_names": "FRED",
            "last_name": "BLOGGS",
            "date_of_birth": "1995-11-17",
            "gender_additional_information": null,
            "prison_number": "G8133UA",
            "criminal_records_office": "351774/14D",
            "police_national_computer": "14/120018R"
          },
          "relationships": {
            "ethnicity": {
              "data": {
                "id": "a4f988ba-5ebc-4b24-9dfe-b7fa0c23c30e",
                "type": "ethnicities"
              }
            },
            "gender": {
              "data": {
                "id": "ffac6763-26d6-4425-8005-6e5d052aed88",
                "type": "genders"
              }
            },
            "profiles": {
              "data": [
                {
                  "id": "28087623-d310-4a1c-bf17-b992b74e30c2",
                  "type": "profiles"
                }
              ]
            }
          }
        },
        {
          "id": "fee70079-08c0-4d1c-a125-bfac8caf24c1",
          "type": "people",
          "attributes": {
            "first_names": "FRANCIS",
            "last_name": "CLOGGS",
            "date_of_birth": "1995-11-17",
            "gender_additional_information": null,
            "prison_number": "G8133UA",
            "criminal_records_office": "351774/14D",
            "police_national_computer": "14/120018R"
          },
          "relationships": {
            "ethnicity": {
              "data": {
                "id": "a4f988ba-5ebc-4b24-9dfe-b7fa0c23c30e",
                "type": "ethnicities"
              }
            },
            "gender": {
              "data": {
                "id": "ffac6763-26d6-4425-8005-6e5d052aed88",
                "type": "genders"
              }
            },
            "profiles": {
              "data": [
                {
                  "id": "5182951e-d121-478a-b61f-79b6afba045f",
                  "type": "profiles"
                }
              ]
            }
          }
        }
      ],
      "included": [
        {
          "id": "28087623-d310-4a1c-bf17-b992b74e30c2",
          "type": "profiles",
          "attributes": {
            "assessment_answers": []
          },
          "relationships": {
            "person": {
              "data": {
                "id": "747f3914-620a-441a-847f-472c79def26c",
                "type": "people"
              }
            },
            "documents": {
              "data": []
            }
          }
        },
        {
          "id": "5182951e-d121-478a-b61f-79b6afba045f",
          "type": "profiles",
          "attributes": {
            "assessment_answers": []
          },
          "relationships": {
            "person": {
              "data": {
                "id": "fee70079-08c0-4d1c-a125-bfac8caf24c1",
                "type": "people"
              }
            },
            "documents": {
              "data": []
            }
          }
        }
      ],
      "links": {
        "self": "http://server/api/people?filter%5Bprison_number%5D=G8133UA&include=profiles&page%5Bnumber%5D=1&page%5Bsize%5D=20",
        "first": "http://server/api/people?filter%5Bprison_number%5D=G8133UA&include=profiles&page%5Bnumber%5D=1&page%5Bsize%5D=20",
        "prev": null,
        "next": null,
        "last": "http://server/api/people?filter%5Bprison_number%5D=G8133UA&include=profiles&page%5Bnumber%5D=1&page%5Bsize%5D=20"
      },
      "meta": {
        "pagination": {
          "per_page": 20,
          "total_pages": 1,
          "total_objects": 2,
          "links": {
            "first": "/api/people?filter%5Bprison_number%5D=G8133UA&include=profiles&page=1",
            "last": "/api/people?filter%5Bprison_number%5D=G8133UA&include=profiles&page=1"
          }
        }
      }
    }
  2. Create a new profile record for the person

    NB: an existing profile record may be re-used across multiple moves. Profiles can be reused over a period of custody. However, we advise that a new profile is created for separate custody periods.

    NB: for people with a prison_number, creating a profile without assessment answers will trigger an initial synchronisation with Nomis. Creating a profile with assessment answers will not trigger a synchronisation with Nomis

    To create a profile pre-filled with the Nomis alerts, for people with a prison_number, simply post a blank profile to the POST /people/id/profiles endpoint:

    curl --request POST \
      --url http://server/api/people/747f3914-620a-441a-847f-472c79def26c/profiles \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/vnd.api+json' \
      --header 'idempotency-key: 5beb8591-6b30-4ab2-8753-21346d1743ab' \
      --data '{
      "data": {
        "type": "profiles"
      }
    }'

    This returns a new profile record, pre-populated with Nomis alerts:

    {
      "data": {
        "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "title": "Any other risks",
              "comments": "lAzCdJPxAuYiYJlAzCdJPxAuYiYJ",
              "created_at": "2014-10-17",
              "expires_at": "2015-11-04",
              "assessment_question_id": "4e37ac1a-a461-45a8-bca9-f0e994d3105e",
              "category": "risk",
              "key": "other_risks",
              "nomis_alert_type": "P",
              "nomis_alert_code": "P0",
              "nomis_alert_type_description": "MAPPP Case",
              "nomis_alert_description": "MAPPA Nominal",
              "imported_from_nomis": true
            },
            {
              "title": "Violent",
              "comments": null,
              "created_at": "2015-02-22",
              "expires_at": null,
              "assessment_question_id": "af8cfc67-757c-4019-9d5e-618017de1617",
              "category": "risk",
              "key": "violent",
              "nomis_alert_type": "R",
              "nomis_alert_code": "ROM",
              "nomis_alert_type_description": "Risk",
              "nomis_alert_description": "OASys Serious Harm-Medium",
              "imported_from_nomis": true
            },
            {
              "title": "Violent",
              "comments": "HRErJMfhUuLHisGPkEhGRpvHSvjfHHRErJMfhUuLHisGPkEhGRpvHSvjfH",
              "created_at": "2017-02-03",
              "expires_at": null,
              "assessment_question_id": "af8cfc67-757c-4019-9d5e-618017de1617",
              "category": "risk",
              "key": "violent",
              "nomis_alert_type": "P",
              "nomis_alert_code": "PC2",
              "nomis_alert_type_description": "MAPPP Case",
              "nomis_alert_description": "MAPPA Cat 2",
              "imported_from_nomis": true
            },
            {
              "title": "Health issue",
              "comments": null,
              "created_at": "2014-07-28",
              "expires_at": null,
              "assessment_question_id": "8872ad2e-b1b6-44c1-a937-b7540e633355",
              "category": "health",
              "key": "health_issue",
              "nomis_alert_type": "DISAB",
              "nomis_alert_code": "ND",
              "nomis_alert_type_description": "Unknown",
              "nomis_alert_description": "No Disability",
              "imported_from_nomis": true
            },
            {
              "title": "Health issue",
              "comments": null,
              "created_at": "2014-07-31",
              "expires_at": null,
              "assessment_question_id": "8872ad2e-b1b6-44c1-a937-b7540e633355",
              "category": "health",
              "key": "health_issue",
              "nomis_alert_type": "DISAB",
              "nomis_alert_code": "ND",
              "nomis_alert_type_description": "Unknown",
              "nomis_alert_description": "No Disability",
              "imported_from_nomis": true
            },
            {
              "title": "Health issue",
              "comments": null,
              "created_at": "2014-10-16",
              "expires_at": null,
              "assessment_question_id": "8872ad2e-b1b6-44c1-a937-b7540e633355",
              "category": "health",
              "key": "health_issue",
              "nomis_alert_type": "DISAB",
              "nomis_alert_code": "ND",
              "nomis_alert_type_description": "Unknown",
              "nomis_alert_description": "No Disability",
              "imported_from_nomis": true
            }
          ]
        },
        "relationships": {
          "person": {
            "data": {
              "id": "747f3914-620a-441a-847f-472c79def26c",
              "type": "people"
            }
          },
          "documents": {
            "data": []
          }
        }
      }
    }

    To create a profile record with specified assessment answers, post a detailed record to the POST /people/id/profiles endpoint. This will not synchronise with Nomis:

    curl --request POST \
      --url http://server/api/people/747f3914-620a-441a-847f-472c79def26c/profiles/ \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX \'
      --header 'content-type: application/vnd.api+json' \
      --header 'idempotency-key: 2915eea5-557d-4bf3-9530-d957347e7f20' \
        --data '{
    "data": {
        "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "title": "Escape",
              "comments": "Very good at climbing fences and picking locks",
              "assessment_question_id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
              "category": "risk",
              "key": "escape",
              "imported_from_nomis": false
            }
          ]
        }
      }
    }'

    This returns the new profile record as specified:

    {
      "data": {
        "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "title": "Escape",
              "comments": "Very good at climbing fences and picking locks",
              "created_at": "2020-07-06",
              "expires_at": null,
              "assessment_question_id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
              "category": "risk",
              "key": "escape",
              "nomis_alert_type": null,
              "nomis_alert_code": null,
              "nomis_alert_type_description": null,
              "nomis_alert_description": null,
              "imported_from_nomis": false
            }
          ]
        },
        "relationships": {
          "person": {
            "data": {
              "id": "747f3914-620a-441a-847f-472c79def26c",
              "type": "people"
            }
          },
          "documents": {
            "data": []
          }
        }
      }
    }

    NB: For a list of all assessment questions, call the GET /reference/assessment_questions endpoint:

    curl --request GET \
      --url http://server/api/reference/assessment_questions \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX'

    Which returns:

    {
      "data": [
        {
          "id": "af8cfc67-757c-4019-9d5e-618017de1617",
          "type": "assessment_questions",
          "attributes": {
            "key": "violent",
            "category": "risk",
            "title": "Violent",
            "disabled_at": null
          }
        },
        {
          "id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
          "type": "assessment_questions",
          "attributes": {
            "key": "escape",
            "category": "risk",
            "title": "Escape",
            "disabled_at": null
          }
        },
        {
          "id": "8f38efb0-36c1-4a56-8c66-3b72c9525f92",
          "type": "assessment_questions",
          "attributes": {
            "key": "hold_separately",
            "category": "risk",
            "title": "Must be held separately",
            "disabled_at": null
          }
        },
        {
          "id": "4e7e54b4-a40c-488f-bdff-c6b2268ca4eb",
          "type": "assessment_questions",
          "attributes": {
            "key": "self_harm",
            "category": "risk",
            "title": "Self harm",
            "disabled_at": null
          }
        },
        {
          "id": "56826f64-da5d-42eb-b360-131e60bcc3d3",
          "type": "assessment_questions",
          "attributes": {
            "key": "concealed_items",
            "category": "risk",
            "title": "Concealed items",
            "disabled_at": null
          }
        },
        {
          "id": "4e37ac1a-a461-45a8-bca9-f0e994d3105e",
          "type": "assessment_questions",
          "attributes": {
            "key": "other_risks",
            "category": "risk",
            "title": "Any other risks",
            "disabled_at": null
          }
        },
        {
          "id": "e6faaf20-3072-4a65-91f7-93d52b16260f",
          "type": "assessment_questions",
          "attributes": {
            "key": "special_diet_or_allergy",
            "category": "health",
            "title": "Special diet or allergy",
            "disabled_at": null
          }
        },
        {
          "id": "8872ad2e-b1b6-44c1-a937-b7540e633355",
          "type": "assessment_questions",
          "attributes": {
            "key": "health_issue",
            "category": "health",
            "title": "Health issue",
            "disabled_at": null
          }
        },
        {
          "id": "7ac3ffc9-57ac-4d0f-aa06-ad15b55c3cee",
          "type": "assessment_questions",
          "attributes": {
            "key": "medication",
            "category": "health",
            "title": "Medication",
            "disabled_at": null
          }
        },
        {
          "id": "bc5fd9d1-6c86-4c39-b9a0-2e88bee98c50",
          "type": "assessment_questions",
          "attributes": {
            "key": "wheelchair",
            "category": "health",
            "title": "Wheelchair user",
            "disabled_at": null
          }
        },
        {
          "id": "bf0d3e65-f88a-4ee5-aad5-60947a1b5a51",
          "type": "assessment_questions",
          "attributes": {
            "key": "pregnant",
            "category": "health",
            "title": "Pregnant",
            "disabled_at": null
          }
        },
        {
          "id": "5a4c5feb-9244-4c29-ab3f-d453c6fee10a",
          "type": "assessment_questions",
          "attributes": {
            "key": "other_health",
            "category": "health",
            "title": "Any other requirements",
            "disabled_at": null
          }
        },
        {
          "id": "5c3ec467-4932-4d58-8281-fb27eaba3ddf",
          "type": "assessment_questions",
          "attributes": {
            "key": "solicitor",
            "category": "court",
            "title": "Solicitor or other legal representation",
            "disabled_at": null
          }
        },
        {
          "id": "821254c9-680b-4eb5-9c15-bf22e31e7c5e",
          "type": "assessment_questions",
          "attributes": {
            "key": "interpreter",
            "category": "court",
            "title": "Sign or other language interpreter",
            "disabled_at": null
          }
        },
        {
          "id": "aad663f1-d213-4ce7-af86-e180bdaa71dd",
          "type": "assessment_questions",
          "attributes": {
            "key": "other_court",
            "category": "court",
            "title": "Any other information",
            "disabled_at": null
          }
        },
        {
          "id": "3a661bc8-5536-43e9-bcea-0a4d9651a175",
          "type": "assessment_questions",
          "attributes": {
            "key": "not_for_release",
            "category": "risk",
            "title": "Not for release",
            "disabled_at": null
          }
        },
        {
          "id": "bafcde0b-46e9-44b2-ad20-de3644256a42",
          "type": "assessment_questions",
          "attributes": {
            "key": "not_to_be_released",
            "category": "risk",
            "title": "Not to be released",
            "disabled_at": null
          }
        },
        {
          "id": "1a73d31a-8dd4-47b6-90a0-15ce4e332539",
          "type": "assessment_questions",
          "attributes": {
            "key": "special_vehicle",
            "category": "health",
            "title": "Requires special vehicle",
            "disabled_at": null
          }
        }
      ]
    }

    An existing profile may be updated (overriding any pre-filled alerts from Nomis) by patching the record via the PATCH /people/id/profiles/id endpoint. This will not synchronise with Nomis:

    curl --request PATCH \
      --url http://server/api/people/747f3914-620a-441a-847f-472c79def26c/profiles/da8e9326-a417-434a-b67e-66a4e15078d4 \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX \
      --header 'content-type: application/vnd.api+json' \
      --header 'idempotency-key: 1915eea5-557d-4bf3-9530-d957347e7f20' \
      --data '{
      "data": {
        "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "title": "Escape",
              "comments": "Not very good at climbing fences and picking locks",
              "assessment_question_id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
              "category": "risk",
              "key": "escape",
              "imported_from_nomis": false
            }
          ]
        }
      }
    }'

    Which returns the updated profile record as:

    {
      "data": {
        "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "title": "Escape",
              "comments": "Not very good at climbing fences and picking locks",
              "created_at": "2020-07-06",
              "expires_at": null,
              "assessment_question_id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
              "category": "risk",
              "key": "escape",
              "nomis_alert_type": null,
              "nomis_alert_code": null,
              "nomis_alert_type_description": null,
              "nomis_alert_description": null,
              "imported_from_nomis": false
            }
          ]
        },
        "relationships": {
          "person": {
            "data": {
              "id": "747f3914-620a-441a-847f-472c79def26c",
              "type": "people"
            }
          },
          "documents": {
            "data": []
          }
        }
      }
    }

    NB: multiple steps are required in order to merge custom assessment_answers with the Nomis-synchronised alerts:

    1. Post a blank profile to POST /people/id/profiles
    2. In your system, combine the desired assessment_answers with those provided from Nomis
    3. Patch the result back to PATCH /people/id/profiles/id
  3. Now that the profile record is available, a new move can be created:

    NB: the move type is specified as "prison_remand" in this example, however this type is not yet supported and will be rendered as "prison_transfer" in the response. We will be adding this new move type shortly. You must pass in "prison_remand" for court to prison, STC, SCH, YOI moves. The move status should be "requested".

    curl --request POST \
      --url http://server/api/moves \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/vnd.api+json' \
      --header 'idempotency-key: 51af7ad4-9ee0-42e6-86e1-979ec631193e' \
      --data '{
      "data": {
        "type": "moves",
        "attributes": {
          "date": "2020-07-06",
          "time_due": "2020-07-06T14:19:22+01:00",
          "status": "requested",
          "additional_information": "example court to prison transfer",
          "move_type": "prison_remand"
        },
        "relationships": {
          "profile": {
            "data": {
              "type": "profiles",
              "id": "da8e9326-a417-434a-b67e-66a4e15078d4"
            }
          },
          "from_location": {
            "data": {
              "type": "locations",
              "id": "8fa68589-8ded-435c-b0c1-ffcade5f1bef"
            }
          },
          "to_location": {
            "data": {
              "type": "locations",
              "id": "067c2855-fa41-493d-9c80-1311a4f7ba45"
            }
          }
        }
      }
    }'

    This returns the new move record:

    {
      "data": {
        "id": "35417916-2467-4836-a433-373448fd8a8b",
        "type": "moves",
        "attributes": {
          "additional_information": "example court to prison transfer",
          "cancellation_reason": null,
          "cancellation_reason_comment": null,
          "created_at": "2020-07-06T17:43:19+01:00",
          "date": "2020-07-06",
          "date_from": null,
          "date_to": null,
          "move_agreed": null,
          "move_agreed_by": null,
          "move_type": "prison_transfer",
          "reference": "AHN7936K",
          "rejection_reason": null,
          "status": "requested",
          "time_due": "2020-07-06T14:19:22+01:00",
          "updated_at": "2020-07-06T17:43:19+01:00"
        },
        "relationships": {
          "profile": {
            "data": {
              "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
              "type": "profiles"
            }
          },
          "from_location": {
            "data": {
              "id": "8fa68589-8ded-435c-b0c1-ffcade5f1bef",
              "type": "locations"
            }
          },
          "to_location": {
            "data": {
              "id": "067c2855-fa41-493d-9c80-1311a4f7ba45",
              "type": "locations"
            }
          },
          "prison_transfer_reason": {
            "data": null
          },
          "court_hearings": {
            "data": []
          },
          "allocation": {
            "data": null
          },
          "original_move": {
            "data": null
          }
        }
      }
    }
  4. The new move can then be accepted changing its status from "requested" to "booked" by calling the accept endpoint:

    curl --request POST \
      --url http://server/api/moves/35417916-2467-4836-a433-373448fd8a8b/accept \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/vnd.api+json' \
      --header 'idempotency-key: 40154352-4a86-4a5b-bddd-9df63b4d59b4' \
      --data '{
      "data": {
        "type": "accepts",
        "attributes": {
          "timestamp": "2020-07-07T15:35:24.316Z"
        }
      }
    }'

    This will return a 204 No Content response.

  5. Journeys should be added to move: please see the separate Journey API walkthrough document.

  6. The move can be started, changing its status from "booked" to "in_transit" by calling the start endpoint:

    curl --request POST \
      --url http://server/api/moves/35417916-2467-4836-a433-373448fd8a8b/start \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/vnd.api+json' \
      --header 'idempotency-key: 45a97e52-dc12-4ad5-a47f-fd02e888942c' \
      --data '{
      "data": {
        "type": "starts",
        "attributes": {
          "timestamp": "2020-07-07T15:40:46.853Z",
          "notes": "van on the way"
        }
      }
    }'

    This will return a 204 No Content response.

  7. Optionally, the current move record can be inspected at any time by calling the GET move endpoint, using an ?include parameter as required to return the full person, profile or location records:

    curl --request GET \
      --url 'http://server/api/moves/35417916-2467-4836-a433-373448fd8a8b?include=profile.person%2Cfrom_location%2Cto_location' \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'idempotency-key: cbbce7f1-7c5a-456f-9ee6-0f7aff362de2'

    Which returns:

    {
      "data": {
        "id": "35417916-2467-4836-a433-373448fd8a8b",
        "type": "moves",
        "attributes": {
          "additional_information": "example court to prison transfer",
          "cancellation_reason": null,
          "cancellation_reason_comment": null,
          "created_at": "2020-07-06T17:43:19+01:00",
          "date": "2020-07-06",
          "date_from": null,
          "date_to": null,
          "move_agreed": null,
          "move_agreed_by": null,
          "move_type": "prison_transfer",
          "reference": "AHN7936K",
          "rejection_reason": null,
          "status": "in_transit",
          "time_due": "2020-07-06T14:19:22+01:00",
          "updated_at": "2020-07-07T16:39:36+01:00"
        },
        "relationships": {
          "profile": {
            "data": {
              "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
              "type": "profiles"
            }
          },
          "from_location": {
            "data": {
              "id": "00034e29-9ef8-4802-a2f5-09342bf9f174",
              "type": "locations"
            }
          },
          "to_location": {
            "data": {
              "id": "067c2855-fa41-493d-9c80-1311a4f7ba45",
              "type": "locations"
            }
          },
          "prison_transfer_reason": {
            "data": null
          },
          "court_hearings": {
            "data": []
          },
          "allocation": {
            "data": null
          },
          "original_move": {
            "data": null
          }
        }
      },
      "included": [
        {
          "id": "da8e9326-a417-434a-b67e-66a4e15078d4",
          "type": "profiles",
          "attributes": {
            "assessment_answers": [
              {
                "title": "Escape",
                "comments": "Very good at climbing fences and picking locks",
                "created_at": "2020-07-06",
                "expires_at": null,
                "assessment_question_id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
                "category": "risk",
                "key": "escape",
                "nomis_alert_type": null,
                "nomis_alert_code": null,
                "nomis_alert_type_description": null,
                "nomis_alert_description": null,
                "imported_from_nomis": false
              }
            ]
          },
          "relationships": {
            "person": {
              "data": {
                "id": "747f3914-620a-441a-847f-472c79def26c",
                "type": "people"
              }
            },
            "documents": {
              "data": []
            }
          }
        },
        {
          "id": "747f3914-620a-441a-847f-472c79def26c",
          "type": "people",
          "attributes": {
            "first_names": "DOMSANIGH",
            "last_name": "CASEDY",
            "date_of_birth": "1995-11-17",
            "assessment_answers": [
              {
                "title": "Escape",
                "comments": "Very good at climbing fences and picking locks",
                "created_at": "2020-07-06",
                "expires_at": null,
                "assessment_question_id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
                "category": "risk",
                "key": "escape",
                "nomis_alert_type": null,
                "nomis_alert_code": null,
                "nomis_alert_type_description": null,
                "nomis_alert_description": null,
                "imported_from_nomis": false
              }
            ],
            "identifiers": [
              {
                "value": "14/120018R",
                "identifier_type": "police_national_computer"
              },
              {
                "value": "G8133UA",
                "identifier_type": "prison_number"
              },
              {
                "value": "351774/14D",
                "identifier_type": "criminal_records_office"
              }
            ],
            "gender_additional_information": null
          },
          "relationships": {
            "ethnicity": {
              "data": {
                "id": "a4f988ba-5ebc-4b24-9dfe-b7fa0c23c30e",
                "type": "ethnicities"
              }
            },
            "gender": {
              "data": {
                "id": "ffac6763-26d6-4425-8005-6e5d052aed88",
                "type": "genders"
              }
            }
          }
        },
        {
          "id": "00034e29-9ef8-4802-a2f5-09342bf9f174",
          "type": "locations",
          "attributes": {
            "key": "hudryc",
            "title": "Huddersfield Youth Court",
            "location_type": "court",
            "nomis_agency_id": "HUDRYC",
            "can_upload_documents": false,
            "disabled_at": null
          },
          "relationships": {
            "suppliers": {
              "data": []
            }
          }
        },
        {
          "id": "067c2855-fa41-493d-9c80-1311a4f7ba45",
          "type": "locations",
          "attributes": {
            "key": "bsi",
            "title": "BRINSFORD (HMP)",
            "location_type": "prison",
            "nomis_agency_id": "BSI",
            "can_upload_documents": false,
            "disabled_at": null
          },
          "relationships": {
            "suppliers": {
              "data": []
            }
          }
        }
      ]
    }
  8. Finally, the move can be completed, changing its status from "in_transit" to "completed" by posting to the complete endpoint:

    curl --request POST \
      --url http://server/api/moves/35417916-2467-4836-a433-373448fd8a8b/complete \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/vnd.api+json' \
      --header 'idempotency-key: 42d19c1f-a741-4fe8-910d-07ffc832aef8' \
      --data '{
      "data": {
        "type": "completes",
        "attributes": {
          "timestamp": "2020-07-07T16:19:17.163Z",
          "notes": "move completed successfully"
        }
      }
    }'

    This will return a 204 No Content response.

Clone this wiki locally