Skip to content

API Walkthroughs 5.2 Court to Prison move without 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.2 Move for a person without a PNC/PN identifier from Court to Prison on a specific move date

When the person to be moved does not have a Prison Number (PN) or Police National Computer (PNC) number, it may be necessary to create a new person record in the system.

  1. Search the system using any other known identifiers, such as Criminal Records Office number

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

    In this example, no records are returned:

    {
      "data": [],
      "links": {
        "self": "http://localhost:5001/api/people?filter%5Bcriminal_records_office%5D=CRO01234dX&include=profiles&page%5Bnumber%5D=1&page%5Bsize%5D=20",
        "first": "http://localhost:5001/api/people?filter%5Bcriminal_records_office%5D=CRO01234dX&include=profiles&page%5Bnumber%5D=1&page%5Bsize%5D=20",
        "prev": null,
        "next": null,
        "last": "http://localhost:5001/api/people?filter%5Bcriminal_records_office%5D=CRO01234dX&include=profiles&page%5Bnumber%5D=1&page%5Bsize%5D=20"
      },
      "meta": {
        "pagination": {
          "per_page": 20,
          "total_pages": 0,
          "total_objects": 0,
          "links": {
            "first": "/api/people?filter%5Bcriminal_records_office%5D=CRO01234dX&include=profiles&page=1",
            "last": "/api/people?filter%5Bcriminal_records_office%5D=CRO01234dX&include=profiles&page=0"
          }
        }
      }
    }
  2. Create a new person record for the person

    First, retrieve reference data for genders:

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

    which returns:

    {
      "data": [
        {
          "id": "1b227566-ef41-4516-b41d-9aec6651243a",
          "type": "genders",
          "attributes": {
            "key": "female",
            "title": "Female",
            "description": null,
            "disabled_at": null,
            "nomis_code": "F"
          }
        },
        {
          "id": "ffac6763-26d6-4425-8005-6e5d052aed88",
          "type": "genders",
          "attributes": {
            "key": "male",
            "title": "Male",
            "description": null,
            "disabled_at": null,
            "nomis_code": "M"
          }
        },
        {
          "id": "a5546a86-2183-4a4f-a352-293e61764586",
          "type": "genders",
          "attributes": {
            "key": "trans",
            "title": "Trans",
            "description": null,
            "disabled_at": null,
            "nomis_code": null
          }
        },
        {
          "id": "94f33833-35f1-4a7c-bbfa-3091e7d7f39b",
          "type": "genders",
          "attributes": {
            "key": "nk",
            "title": "Not Known / Not Recorded",
            "description": null,
            "disabled_at": "2019-07-22T16:35:43+01:00",
            "nomis_code": "NK"
          }
        },
        {
          "id": "6d440a66-c281-4aae-8c9d-92ff84cf62ff",
          "type": "genders",
          "attributes": {
            "key": "ns",
            "title": "Not Specified (Indeterminate)",
            "description": null,
            "disabled_at": "2019-07-22T16:35:43+01:00",
            "nomis_code": "NS"
          }
        }
      ]
    }

    Similarly, reference data for ethnicities can be retrieved with:

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

    Which returns:

    {
      "data": [
        {
          "id": "9894def5-2997-4c46-affa-e868412e2d0e",
          "type": "ethnicities",
          "attributes": {
            "key": "a1",
            "title": "Asian/Asian British: Indian",
            "description": null,
            "nomis_code": "A1",
            "disabled_at": null
          }
        },
        {
          "id": "91a0a306-3269-4c76-85f6-79957b97d41f",
          "type": "ethnicities",
          "attributes": {
            "key": "a2",
            "title": "Asian/Asian British: Pakistani",
            "description": null,
            "nomis_code": "A2",
            "disabled_at": null
          }
        },
        {
          "id": "639a0389-5fac-4e1b-83ec-f8257e43f9d6",
          "type": "ethnicities",
          "attributes": {
            "key": "a3",
            "title": "Asian/Asian British: Bangladeshi",
            "description": null,
            "nomis_code": "A3",
            "disabled_at": null
          }
        },
        {
          "id": "8bf95acf-2fb3-4d7a-8b30-b06c6cb821e2",
          "type": "ethnicities",
          "attributes": {
            "key": "a4",
            "title": "Asian/Asian British: Chinese",
            "description": null,
            "nomis_code": "A4",
            "disabled_at": null
          }
        },
        {
          "id": "983d219e-57f2-4513-b77b-58f22bee9769",
          "type": "ethnicities",
          "attributes": {
            "key": "a9",
            "title": "Asian/Asian British: Any other backgr'nd",
            "description": null,
            "nomis_code": "A9",
            "disabled_at": null
          }
        },
        {
          "id": "6a6e1d05-fcd6-465d-b6fc-a67d3f4988da",
          "type": "ethnicities",
          "attributes": {
            "key": "b1",
            "title": "Black/Black British: Caribbean",
            "description": null,
            "nomis_code": "B1",
            "disabled_at": null
          }
        },
        {
          "id": "a4f988ba-5ebc-4b24-9dfe-b7fa0c23c30e",
          "type": "ethnicities",
          "attributes": {
            "key": "b2",
            "title": "Black/Black British: African",
            "description": null,
            "nomis_code": "B2",
            "disabled_at": null
          }
        },
        {
          "id": "69ec16cd-7172-47bf-a568-3283edb0e119",
          "type": "ethnicities",
          "attributes": {
            "key": "b9",
            "title": "Black/Black British: Any other Backgr'nd",
            "description": null,
            "nomis_code": "B9",
            "disabled_at": null
          }
        },
        {
          "id": "6e74c8ae-2ba7-4b1d-afdd-d8f59ede69d5",
          "type": "ethnicities",
          "attributes": {
            "key": "m1",
            "title": "Mixed: White and Black Caribbean",
            "description": null,
            "nomis_code": "M1",
            "disabled_at": null
          }
        },
        {
          "id": "572a9f0f-5b69-4535-b6a6-6d2782a1838f",
          "type": "ethnicities",
          "attributes": {
            "key": "m2",
            "title": "Mixed: White and Black African",
            "description": null,
            "nomis_code": "M2",
            "disabled_at": null
          }
        },
        {
          "id": "f480eeff-848c-4fcc-bd75-9f61850fa5bf",
          "type": "ethnicities",
          "attributes": {
            "key": "m3",
            "title": "Mixed: White and Asian",
            "description": null,
            "nomis_code": "M3",
            "disabled_at": null
          }
        },
        {
          "id": "1bffeb81-6746-4218-a073-810495416d9a",
          "type": "ethnicities",
          "attributes": {
            "key": "m9",
            "title": "Mixed: Any other background",
            "description": null,
            "nomis_code": "M9",
            "disabled_at": null
          }
        },
        {
          "id": "d1b29783-77f8-498b-b0a5-73e192e59e58",
          "type": "ethnicities",
          "attributes": {
            "key": "ns",
            "title": "Prefer not to say",
            "description": null,
            "nomis_code": "NS",
            "disabled_at": null
          }
        },
        {
          "id": "379ced2e-a3f2-44dd-8ebe-e935e600ad68",
          "type": "ethnicities",
          "attributes": {
            "key": "o2",
            "title": "Other: Arab",
            "description": null,
            "nomis_code": "O2",
            "disabled_at": null
          }
        },
        {
          "id": "a88e980c-aef3-4d50-9935-0186f22947d2",
          "type": "ethnicities",
          "attributes": {
            "key": "o9",
            "title": "Other: Any other background",
            "description": null,
            "nomis_code": "O9",
            "disabled_at": null
          }
        },
        {
          "id": "318cbc7b-d8d9-4798-9430-a588872446aa",
          "type": "ethnicities",
          "attributes": {
            "key": "w1",
            "title": "White: Eng./Welsh/Scot./N.Irish/British",
            "description": null,
            "nomis_code": "W1",
            "disabled_at": null
          }
        },
        {
          "id": "56508a65-c618-497a-9575-81671c70b92f",
          "type": "ethnicities",
          "attributes": {
            "key": "w2",
            "title": "White : Irish",
            "description": null,
            "nomis_code": "W2",
            "disabled_at": null
          }
        },
        {
          "id": "7807fb2a-712a-4350-af48-3a2f79e18871",
          "type": "ethnicities",
          "attributes": {
            "key": "w3",
            "title": "White: Gypsy or Irish Traveller",
            "description": null,
            "nomis_code": "W3",
            "disabled_at": null
          }
        },
        {
          "id": "d567cfb2-9622-4979-be4a-a1341cc4aefa",
          "type": "ethnicities",
          "attributes": {
            "key": "w9",
            "title": "White: Any other background",
            "description": null,
            "nomis_code": "W9",
            "disabled_at": null
          }
        },
        {
          "id": "622b7a0d-a66d-4b10-83c2-79221fdc67c5",
          "type": "ethnicities",
          "attributes": {
            "key": "merge",
            "title": "Needs to be confirmed following Merge",
            "description": null,
            "nomis_code": "MERGE",
            "disabled_at": "2019-07-28T12:51:30+01:00"
          }
        }
      ]
    }

    Finally, using the reference data and other known data about the person, create a new person record:

    curl --request POST \
      --url http://server/api/people \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: d7c02900-43b5-4dbb-9664-8854d7611753' \
      --data '{
      "data": {
        "type": "people",
        "attributes": {
          "first_names": "Bob",
          "last_name": "Roberts",
          "date_of_birth": "1980-01-02",
          "gender_additional_information": null,
          "prison_number": null,
          "police_national_computer": null,
          "criminal_records_office": "CRO01234d"
        },
        "relationships": {
          "gender": {
            "data": {
              "type": "genders",
              "id": "ffac6763-26d6-4425-8005-6e5d052aed88"
            }
          },
          "ethnicity": {
            "data": {
              "type": "ethnicities",
              "id": "f480eeff-848c-4fcc-bd75-9f61850fa5bf"
            }
          }
        }
      }
    }'

    This returns a new person record:

    {
      "data": {
        "id": "f01fb1e8-9c1e-4f1b-9bef-61fdcf153d7e",
        "type": "people",
        "attributes": {
          "first_names": "Bob",
          "last_name": "Roberts",
          "date_of_birth": "1980-01-02",
          "gender_additional_information": null,
          "prison_number": null,
          "criminal_records_office": "CRO01234d",
          "police_national_computer": null
        },
        "relationships": {
          "ethnicity": {
            "data": {
              "id": "f480eeff-848c-4fcc-bd75-9f61850fa5bf",
              "type": "ethnicities"
            }
          },
          "gender": {
            "data": {
              "id": "ffac6763-26d6-4425-8005-6e5d052aed88",
              "type": "genders"
            }
          },
          "profiles": {
            "data": []
          }
        }
      }
    }
  3. Create a new profile record for the person. As the person does not have a Prison Number (PN), they will not synchronise with Nomis. So the profile assessment answers (PTR) will need to be set manually.

    First, retrieve the assessment questions reference data:

    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
          }
        }
      ]
    }

    Using the assessment questions reference data, create a new profile record with:

    curl --request POST \
      --url http://server/api/people/f01fb1e8-9c1e-4f1b-9bef-61fdcf153d7e/profiles \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: 1ff68047-a8b3-4e08-bf8a-4116a5db6d60' \
      --data '{
      "data": {
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "key": "violent",
              "category": "risk",
              "title": "Violent",
              "comments": "does not like marmite",
              "assessment_question_id": "af8cfc67-757c-4019-9d5e-618017de1617",
              "imported_from_nomis": false
            },
            {
              "key": "escape",
              "category": "risk",
              "title": "Escape",
              "comments": "good at climbing fences",
              "assessment_question_id": "f2db9a8f-a5a9-40cf-875b-d1f5f62b2497",
              "imported_from_nomis": false
            },
            {
              "key": "hold_separately",
              "category": "risk",
              "title": "Must be held separately",
              "comments": "must be held separately",
              "assessment_question_id": "8f38efb0-36c1-4a56-8c66-3b72c9525f92",
              "imported_from_nomis": false
            },
            {
              "key": "special_diet_or_allergy",
              "category": "health",
              "title": "Special diet or allergy",
              "comments": "peanut allergy",
              "assessment_question_id": "e6faaf20-3072-4a65-91f7-93d52b16260f",
              "imported_from_nomis": false
            }
          ]
        }
      }
    }'

    This returns the new profile record:

    {
      "data": {
        "id": "2f8f9c21-442f-48d9-a15e-f636dc23342b",
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "title": "Violent",
              "comments": "does not like marmite",
              "created_at": "2020-07-28",
              "expires_at": null,
              "assessment_question_id": "af8cfc67-757c-4019-9d5e-618017de1617",
              "category": "risk",
              "key": "violent",
              "nomis_alert_type": null,
              "nomis_alert_code": null,
              "nomis_alert_type_description": null,
              "nomis_alert_description": null,
              "imported_from_nomis": false
            },
            {
              "title": "Escape",
              "comments": "good at climbing fences",
              "created_at": "2020-07-28",
              "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
            },
            {
              "title": "Must be held separately",
              "comments": "must be held separately",
              "created_at": "2020-07-28",
              "expires_at": null,
              "assessment_question_id": "8f38efb0-36c1-4a56-8c66-3b72c9525f92",
              "category": "risk",
              "key": "hold_separately",
              "nomis_alert_type": null,
              "nomis_alert_code": null,
              "nomis_alert_type_description": null,
              "nomis_alert_description": null,
              "imported_from_nomis": false
            },
            {
              "title": "Special diet or allergy",
              "comments": "peanut allergy",
              "created_at": "2020-07-28",
              "expires_at": null,
              "assessment_question_id": "e6faaf20-3072-4a65-91f7-93d52b16260f",
              "category": "health",
              "key": "special_diet_or_allergy",
              "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": "f01fb1e8-9c1e-4f1b-9bef-61fdcf153d7e",
              "type": "people"
            }
          },
          "documents": {
            "data": []
          },
          "person_escort_record": {
            "data": null
          }
        }
      }
    }
  4. Create a Court to Prison prison_remand move using the new profile

    curl --request POST \
      --url http://server/api/moves \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: a2772a54-606c-409f-aaff-ce2d8ef8ffa9' \
      --data '{
      "data": {
        "type": "moves",
        "attributes": {
          "date": "2020-07-31",
          "time_due": "2020-07-31T09:00:00+01:00",
          "status": "requested",
          "additional_information": "example Court to Prison prison_remand: Huddersfield Youth Court to HMP Isle of Wight",
          "move_type": "prison_remand"
        },
        "relationships": {
          "profile": {
            "data": {
              "type": "profiles",
              "id": "2f8f9c21-442f-48d9-a15e-f636dc23342b"
            }
          },
          "from_location": {
            "data": {
              "type": "locations",
              "id": "00034e29-9ef8-4802-a2f5-09342bf9f174"
            }
          },
          "to_location": {
            "data": {
              "type": "locations",
              "id": "056eed18-772b-45b3-b64a-4d7d563641f7"
            }
          }
        }
      }
    }'

    This returns the new move record:

    {
      "data": {
        "id": "f69fec91-07f1-4048-aa39-aae993f5ad3d",
        "type": "moves",
        "attributes": {
          "additional_information": "example Court to Prison prison_remand: Huddersfield Youth Court to HMP Isle of Wight",
          "cancellation_reason": null,
          "cancellation_reason_comment": null,
          "created_at": "2020-07-28T16:33:35+01:00",
          "date": "2020-07-31",
          "date_from": null,
          "date_to": null,
          "move_agreed": null,
          "move_agreed_by": null,
          "move_type": "prison_remand",
          "reference": "JEF3784P",
          "rejection_reason": null,
          "status": "requested",
          "time_due": "2020-07-31T09:00:00+01:00",
          "updated_at": "2020-07-28T16:33:35+01:00"
        },
        "relationships": {
          "profile": {
            "data": {
              "id": "2f8f9c21-442f-48d9-a15e-f636dc23342b",
              "type": "profiles"
            }
          },
          "from_location": {
            "data": {
              "id": "00034e29-9ef8-4802-a2f5-09342bf9f174",
              "type": "locations"
            }
          },
          "to_location": {
            "data": {
              "id": "056eed18-772b-45b3-b64a-4d7d563641f7",
              "type": "locations"
            }
          },
          "prison_transfer_reason": {
            "data": null
          },
          "court_hearings": {
            "data": []
          },
          "allocation": {
            "data": null
          },
          "original_move": {
            "data": null
          }
        }
      }
    }
  5. 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/f69fec91-07f1-4048-aa39-aae993f5ad3d/accept \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: 9a3b34d0-20a3-4ded-995f-bd9ff12eca47' \
      --data '{
      "data": {
        "type": "accepts",
        "attributes": {
          "timestamp": "2020-07-28T16:21:41.619Z"
        }
      }
    }'

    This will return a 204 No Content response.

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

  7. 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/f69fec91-07f1-4048-aa39-aae993f5ad3d/start \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: 51099c07-8f35-405c-a371-72bdefe28dea' \
      --data '{
      "data": {
        "type": "starts",
        "attributes": {
          "timestamp": "2020-07-28T16:21:50.380Z",
          "notes": "van on the way"
        }
      }
    }'

    This will return a 204 No Content response.

  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/f69fec91-07f1-4048-aa39-aae993f5ad3d/complete \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: df33ff29-784d-4391-b189-f7c92f52f841' \
      --data '{
      "data": {
        "type": "completes",
        "attributes": {
          "timestamp": "2020-07-28T16:22:40.382Z",
          "notes": "all is well"
        }
      }
    }'

    This will return a 204 No Content response.

  9. 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/f69fec91-07f1-4048-aa39-aae993f5ad3d?include=profile.person%2Cfrom_location%2Cto_location' \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX'

    Which returns:

    {
      "data": {
        "id": "f69fec91-07f1-4048-aa39-aae993f5ad3d",
        "type": "moves",
        "attributes": {
          "additional_information": "example Court to Prison prison_remand: Huddersfield Youth Court to HMP Isle of Wight",
          "cancellation_reason": null,
          "cancellation_reason_comment": null,
          "created_at": "2020-07-28T16:33:35+01:00",
          "date": "2020-07-31",
          "date_from": null,
          "date_to": null,
          "move_agreed": null,
          "move_agreed_by": null,
          "move_type": "prison_remand",
          "reference": "JEF3784P",
          "rejection_reason": null,
          "status": "completed",
          "time_due": "2020-07-31T09:00:00+01:00",
          "updated_at": "2020-07-28T16:34:01+01:00"
        },
        "relationships": {
          "profile": {
            "data": {
              "id": "2f8f9c21-442f-48d9-a15e-f636dc23342b",
              "type": "profiles"
            }
          },
          "from_location": {
            "data": {
              "id": "00034e29-9ef8-4802-a2f5-09342bf9f174",
              "type": "locations"
            }
          },
          "to_location": {
            "data": {
              "id": "056eed18-772b-45b3-b64a-4d7d563641f7",
              "type": "locations"
            }
          },
          "prison_transfer_reason": {
            "data": null
          },
          "court_hearings": {
            "data": []
          },
          "allocation": {
            "data": null
          },
          "original_move": {
            "data": null
          }
        }
      },
      "included": [
        {
          "id": "2f8f9c21-442f-48d9-a15e-f636dc23342b",
          "type": "profiles",
          "attributes": {
            "assessment_answers": [
              {
                "title": "Violent",
                "comments": "does not like marmite",
                "created_at": "2020-07-28",
                "expires_at": null,
                "assessment_question_id": "af8cfc67-757c-4019-9d5e-618017de1617",
                "category": "risk",
                "key": "violent",
                "nomis_alert_type": null,
                "nomis_alert_code": null,
                "nomis_alert_type_description": null,
                "nomis_alert_description": null,
                "imported_from_nomis": false
              },
              {
                "title": "Escape",
                "comments": "good at climbing fences",
                "created_at": "2020-07-28",
                "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
              },
              {
                "title": "Must be held separately",
                "comments": "must be held separately",
                "created_at": "2020-07-28",
                "expires_at": null,
                "assessment_question_id": "8f38efb0-36c1-4a56-8c66-3b72c9525f92",
                "category": "risk",
                "key": "hold_separately",
                "nomis_alert_type": null,
                "nomis_alert_code": null,
                "nomis_alert_type_description": null,
                "nomis_alert_description": null,
                "imported_from_nomis": false
              },
              {
                "title": "Special diet or allergy",
                "comments": "peanut allergy",
                "created_at": "2020-07-28",
                "expires_at": null,
                "assessment_question_id": "e6faaf20-3072-4a65-91f7-93d52b16260f",
                "category": "health",
                "key": "special_diet_or_allergy",
                "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": "f01fb1e8-9c1e-4f1b-9bef-61fdcf153d7e",
                "type": "people"
              }
            },
            "documents": {
              "data": []
            },
            "person_escort_record": {
              "data": null
            }
          }
        },
        {
          "id": "f01fb1e8-9c1e-4f1b-9bef-61fdcf153d7e",
          "type": "people",
          "attributes": {
            "first_names": "Bob",
            "last_name": "Roberts",
            "date_of_birth": "1980-01-02",
            "gender_additional_information": null,
            "prison_number": null,
            "criminal_records_office": "CRO01234d",
            "police_national_computer": null
          },
          "relationships": {
            "ethnicity": {
              "data": {
                "id": "f480eeff-848c-4fcc-bd75-9f61850fa5bf",
                "type": "ethnicities"
              }
            },
            "gender": {
              "data": {
                "id": "ffac6763-26d6-4425-8005-6e5d052aed88",
                "type": "genders"
              }
            },
            "profiles": {
              "data": [
                {
                  "id": "2f8f9c21-442f-48d9-a15e-f636dc23342b",
                  "type": "profiles"
                }
              ]
            }
          }
        },
        {
          "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": "056eed18-772b-45b3-b64a-4d7d563641f7",
          "type": "locations",
          "attributes": {
            "key": "iwi",
            "title": "ISLE OF WIGHT (HMP)",
            "location_type": "prison",
            "nomis_agency_id": "IWI",
            "can_upload_documents": false,
            "disabled_at": null
          },
          "relationships": {
            "suppliers": {
              "data": []
            }
          }
        }
      ]
    }
Clone this wiki locally