Skip to content

API Walkthroughs 4.2 Police to Court move without PNC PN

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

Moves API Walkthrough

4. Police station to Court moves

4.2 Move for a person without a PNC from a Police station to a Court with a specific move date

  1. [FRONTEND] The initial move record is created in a requested state with a specific move date by a PECS Police user via the frontend. New person and profile records are assigned to the move.

    It is not expected that suppliers would create the initial record. For the purposes of testing however, frontend requests can be simulated with the following calls:

    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: 36beae36-6a1e-4b83-8acd-c77ce06b2e6a' \
      --data '{
      "data": {
        "type": "people",
        "attributes": {
          "first_names": "Bob",
          "last_name": "Roberts",
          "date_of_birth": "1980-02-03",
          "gender_additional_information": null,
          "prison_number": null,
          "police_national_computer": null,
          "criminal_records_office": null
        },
        "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": "def3049e-5c91-4196-a171-2fbf76c27b82",
        "type": "people",
        "attributes": {
          "first_names": "Bob",
          "last_name": "Roberts",
          "date_of_birth": "1980-02-03",
          "gender_additional_information": null,
          "prison_number": null,
          "criminal_records_office": null,
          "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": []
          }
        }
      }
    }
  2. [FRONTEND] 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:

    curl --request POST \
      --url http://server/api/people/def3049e-5c91-4196-a171-2fbf76c27b82/profiles \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: c5ab29ec-20a8-4917-ba2b-72ec070b9684' \
      --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": "85e18695-3f93-480d-ad3d-9f6d0f8c21a8",
        "type": "profiles",
        "attributes": {
          "assessment_answers": [
            {
              "title": "Violent",
              "comments": "does not like marmite",
              "created_at": "2020-07-30",
              "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-30",
              "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-30",
              "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-30",
              "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": "def3049e-5c91-4196-a171-2fbf76c27b82",
              "type": "people"
            }
          },
          "documents": {
            "data": []
          },
          "person_escort_record": {
            "data": null
          }
        }
      }
    }
  3. [FRONTEND] Create the Police to Court court_appearance move request.

    # create move request (Guildford Custody Suite to Huddersfield Youth Court) with a specific move date, 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: f0b4b09c-bece-49be-9309-e9b8705fd5c1' \
      --data '{
      "data": {
        "type": "moves",
        "attributes": {
          "date": "2020-08-01",
          "time_due": "2020-08-01T09:00:00+01:00",
          "status": "requested",
          "additional_information": "example Police to Court transfer: Guildford Custody Suite to Huddersfield Youth Court",
          "move_type": "court_appearance"
        },
        "relationships": {
          "profile": {
            "data": {
              "type": "profiles",
              "id": "85e18695-3f93-480d-ad3d-9f6d0f8c21a8"
            }
          },
          "from_location": {
            "data": {
              "type": "locations",
              "id": "8fadb516-f10a-45b1-91b7-a256196829f9"
            }
          },
          "to_location": {
            "data": {
              "type": "locations",
              "id": "00034e29-9ef8-4802-a2f5-09342bf9f174"
            }
          }
        }
      }
    }'
  4. Suppliers can retrieve a list of requested moves for specific dates by calling the get moves endpoint with appropriate filters

    curl --request GET \
      --url 'http://server/api/moves?filter%5Bdate_from%5D=2020-08-01&filter%5Bdate_to%5D=2020-08-01&filter%5Bstatus%5D=requested&include=profile.person%2Cfrom_location%2Cto_location' \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX'

    This will return the following JSON:

    {
      "data": [
        {
          "id": "2ce2370e-3f2f-4444-b109-a97ad82387f7",
          "type": "moves",
          "attributes": {
            "additional_information": "example Police to Court transfer: Guildford Custody Suite to Huddersfield Youth Court",
            "cancellation_reason": null,
            "cancellation_reason_comment": null,
            "created_at": "2020-07-30T16:41:37+01:00",
            "date": "2020-08-01",
            "date_from": null,
            "date_to": null,
            "move_agreed": null,
            "move_agreed_by": null,
            "move_type": "court_appearance",
            "reference": "VWT2753X",
            "rejection_reason": null,
            "status": "requested",
            "time_due": "2020-08-01T09:00:00+01:00",
            "updated_at": "2020-07-30T16:41:37+01:00"
          },
          "relationships": {
            "profile": {
              "data": {
                "id": "85e18695-3f93-480d-ad3d-9f6d0f8c21a8",
                "type": "profiles"
              }
            },
            "from_location": {
              "data": {
                "id": "8fadb516-f10a-45b1-91b7-a256196829f9",
                "type": "locations"
              }
            },
            "to_location": {
              "data": {
                "id": "00034e29-9ef8-4802-a2f5-09342bf9f174",
                "type": "locations"
              }
            },
            "prison_transfer_reason": {
              "data": null
            },
            "court_hearings": {
              "data": []
            },
            "allocation": {
              "data": null
            },
            "original_move": {
              "data": null
            }
          }
        }
      ],
      "included": [
        {
          "id": "85e18695-3f93-480d-ad3d-9f6d0f8c21a8",
          "type": "profiles",
          "attributes": {
            "assessment_answers": [
              {
                "title": "Violent",
                "comments": "does not like marmite",
                "created_at": "2020-07-30",
                "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-30",
                "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-30",
                "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-30",
                "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": "def3049e-5c91-4196-a171-2fbf76c27b82",
                "type": "people"
              }
            },
            "documents": {
              "data": []
            },
            "person_escort_record": {
              "data": null
            }
          }
        },
        {
          "id": "def3049e-5c91-4196-a171-2fbf76c27b82",
          "type": "people",
          "attributes": {
            "first_names": "Bob",
            "last_name": "Roberts",
            "date_of_birth": "1980-02-03",
            "gender_additional_information": null,
            "prison_number": null,
            "criminal_records_office": null,
            "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": "85e18695-3f93-480d-ad3d-9f6d0f8c21a8",
                  "type": "profiles"
                }
              ]
            }
          }
        },
        {
          "id": "8fadb516-f10a-45b1-91b7-a256196829f9",
          "type": "locations",
          "attributes": {
            "key": "sry016",
            "title": "Guildford Custody Suite",
            "location_type": "police",
            "nomis_agency_id": "SRY016",
            "can_upload_documents": false,
            "disabled_at": null
          },
          "relationships": {
            "suppliers": {
              "data": [
                {
                  "id": "bccf4d77-984d-560c-9ffd-9badbb9157ca",
                  "type": "suppliers"
                }
              ]
            }
          }
        },
        {
          "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": []
            }
          }
        }
      ],
      "links": {
        "self": "http://localhost:5001/api/moves?filter%5Bdate_from%5D=2020-08-01&filter%5Bdate_to%5D=2020-08-01&filter%5Bstatus%5D=requested&include=profile.person%2Cfrom_location%2Cto_location&page%5Bnumber%5D=1&page%5Bsize%5D=20",
        "first": "http://localhost:5001/api/moves?filter%5Bdate_from%5D=2020-08-01&filter%5Bdate_to%5D=2020-08-01&filter%5Bstatus%5D=requested&include=profile.person%2Cfrom_location%2Cto_location&page%5Bnumber%5D=1&page%5Bsize%5D=20",
        "prev": null,
        "next": null,
        "last": "http://localhost:5001/api/moves?filter%5Bdate_from%5D=2020-08-01&filter%5Bdate_to%5D=2020-08-01&filter%5Bstatus%5D=requested&include=profile.person%2Cfrom_location%2Cto_location&page%5Bnumber%5D=1&page%5Bsize%5D=20"
      },
      "meta": {
        "pagination": {
          "per_page": 20,
          "total_pages": 1,
          "total_objects": 1,
          "links": {
            "first": "/api/moves?filter%5Bdate_from%5D=2020-08-01&filter%5Bdate_to%5D=2020-08-01&filter%5Bstatus%5D=requested&include=profile.person%2Cfrom_location%2Cto_location&page=1",
            "last": "/api/moves?filter%5Bdate_from%5D=2020-08-01&filter%5Bdate_to%5D=2020-08-01&filter%5Bstatus%5D=requested&include=profile.person%2Cfrom_location%2Cto_location&page=1"
          }
        }
      }
    }
  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/2ce2370e-3f2f-4444-b109-a97ad82387f7/accept \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: 3e33c8d0-baba-496d-adf7-187c17e0b4a2' \
      --data '{
      "data": {
        "type": "accepts",
        "attributes": {
          "timestamp": "2020-07-30T16:07:28.143Z"
        }
      }
    }'

    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/2ce2370e-3f2f-4444-b109-a97ad82387f7/start \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: 01f56b74-d842-4db2-89cf-240f96ace883' \
      --data '{
      "data": {
        "type": "starts",
        "attributes": {
          "timestamp": "2020-07-30T16:07:36.549Z",
          "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/2ce2370e-3f2f-4444-b109-a97ad82387f7/complete \
      --header 'accept: application/vnd.api+json; version=2' \
      --header 'authorization: Bearer XXX' \
      --header 'content-type: application/json' \
      --header 'idempotency-key: 0fa16867-4d84-466e-999c-1f8f1633a917' \
      --data '{
      "data": {
        "type": "completes",
        "attributes": {
          "timestamp": "2020-07-30T16:07:43.837Z",
          "notes": "all is well"
        }
      }
    }'

    This will return a 204 No Content response.

Clone this wiki locally