Package Manager API Implementation - department-of-veterans-affairs/caseflow GitHub Wiki

Package Manager API Implementation

Once an address has been validated it can now proceed over to Package Manager. Package Manager API has multiple endpoints that will be used for creating the communication package which has information about the package itself and the distribution which will be info on where the package will be sent.

Endpoints

We will be using multiple Package Manager API endpoints to handle the creation/submitting of packages and distributions to the post offices.

Type Endpoint Description
POST /package-manager-service/communication-package Create a communication package
POST /package-manager-service/distribution Create and submit a distribution
GET /idt/api/v2/distributions/{distribution_id} Get distribution package

Success Codes

Code Description
200 Request processed successfully
201 Resource created successfully

Creating a Package Request Params

{
  "file_number": "string",
  "name": "string",
  "document_reference_ids": [
    {
      "id": "string",
      "copies": number
    }
  ]
}

Success Object

{
  "id": "string",
  "file_number": "string",
  "document_referenced": [
    {
      "id": "string",
      "copies": number,
    }
  ],
  "status": "string",
  "created_date": "string",
  "name": "string"
}

Data Definitions

Data Description
id ID of the communication package
file_number File Number associated with the documents in the package.
name User friendly name for the communication package.
document_referenced[].id ID of the document referenced
document_referenced[].copies Number of copies to include in the Communication Package, must be at least 1
status Status of the communication Package
created_date Communication package creation time stamp

Error Response Codes

Code Description
400 There was an error encountered processing the Request. This request shouldn't be retried until corrected.
403 The server cannot create the new communication package due to insufficient privileges

Creating and Submitting a Distribution Request Params

{
  "communication_package_id": "string",
  "recipient": {
    "type": "string",
    "name": "string",
    "first_name": "string",
    "middle_name": "string",
    "last_name": "string",
    "participant_id": "string",
    "poa_code": "string",
    "claimant_station_of_jurisdiction": "string"
  },
  "destinations": [
    "type": "string",
    "address_line1": "string",
    "address_line2": "string",
    "address_line3": "string",
    "address_line4": "string",
    "address_line5": "string",
    "address_line6": "string",
    "treat_line2_as_addressee": boolean,
    "treat_line3_as_addressee": boolean,
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country_name": "string",
    "country_code": "string",
    "email_address": "string",
    "phone_number": "string"
  ]
}

Success Object

{
  "id": "string",
   "recipient": {
      "type": "string",
      "name": "string",
      "first_name": "string",
      "middle_name": "string",
      "last_name": "string",
      "participant_id": "string",
      "poa_code": "string",
      "claimant_station_of_jurisdiction": "string"
    },
     "description": "string",
     "communication_package_id": "string",
     "destinations": [
      {
        "type": "string",
        "address_line1": "string",
        "address_line2": "string",
        "address_line3": "string",
        "address_line4": "string",
        "address_line5": "string",
        "address_line6": "string",
        "treat_line2_as_addressee": boolean,
        "treat_line3_as_addressee": boolean,
        "city": "string",
        "state": "string",
        "postal_code": "string",
        "country_name": "string",
        "country_code": "string",
        "email_address": "string",
        "phone_number": "string",
      }
    ],
    "status": "string",
    "sent_to_cbcm_date" : "string"
    } 
  }

Getting a Distribution URL Params

id - The Distribution UUID

Success Object

{
  "id": 1234,
  "distribution_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "recipient": {
    "type": "organization",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "string"
  },
  "destinations": [
    {
      "type": "string",
      "address_line_1": "string",
      "address_line_2": "string",
      "address_line_3": "string",
      "address_line_4": "string",
      "address_line_5": "string",
      "address_line_6": "string",
      "treat_line_2_as_addressee": true,
      "treat_line_3_as_addressee": true,
      "city": "string",
      "state": "string",
      "postal_code": "string",
      "country_name": "string",
      "country_code": "string"
    }
  ],
  "status": "IN_PROGRESS",
  "sent_to_cbcm_date": "string"
}

Data Definitions

Data Description
communication_package_id Communication Package id
recipient.type Recipient’s type. Must be either 'organization', 'person', 'system', or 'ro-colocated'
recipient.name Recipient’s name. If type is not 'person' then it must not be null.
recipient.first_name Recipient’s first name. Cannot be null if type is 'person'
recipient.middle_name Recipient’s middle name. Optional
recipient.last_name Recipient’s last name. Cannot be null if type is 'person'
recipient.participant_id Recipient’s participant id
recipient.poa_code Recipient’s POA code. Cannot be null if type is 'ro-colocated'
recipient.claimant_station_of_jurisdiction Recipient's claimant station of jurisdiction. Cannot be null if type is 'ro-colocated'
destinations[].status ID of the communication package
destinations[].cbcm_send_attempt_date File Number associated with the documents in the package.
destinations[].type Destination Type. Must be 'domesticAddress', 'internationalAddress', 'militaryAddress', 'derived', 'email', or 'sms'. Cannot be 'physicalAddress'.
destinations[].address_line1 Solely the first line of the requested address without city, state, or zip
destinations[].address_line2 Solely the second line of the requested address without city, state, or zip
destinations[].address_line3 Solely the third line of the requested address without city, state, or zip
destinations[].address_line4 Solely the fourth line of the requested address without city, state, or zip
destinations[].address_line5 Solely the fifth line of the requested address without city, state, or zip
destinations[].address_line6 Solely the sixth line of the requested address without city, state, or zip
destinations[].city City for this destination. Must not be null if type is 'domestic', 'international', or 'military'
destinations[].state State for this destination. Must be 2 letter ISO. Must not be null if type is 'domestic', 'international', or 'military'
destinations[].postal_code Postal code for this destination. Must not be null if type is 'domestic', 'international', or 'military'
destinations[].country_name Country name for this destination. Must not be null if type is 'international'
destinations[].country_code Country code for this destination. Must be a 2 letter ISO code
destinations[].email_address Email Address for this destination. Cannot be null if type is 'email'
destinations[].phone_number Phone Number for this destination. Cannot be null if type is 'sms'

Error Response Codes

Code Description
400 There was an error encountered processing the Request. This request shouldn't be retried until corrected.
403 The server cannot create the distribution due to insufficient privileges.
404 The communication package could not be found but may be available again in the future
500 An error has occurred while trying to process the request