{
  "info": {
    "_postman_id": "b6aa9d65-f536-4fe0-ae6e-71e0c2251dca",
    "name": "Ship API - Container",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "22736309"
  },
  "item": [
    {
      "name": "Manage",
      "item": [
        {
          "name": "Get All Containers",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "method": "GET",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/Active?pageSize=50&pageIndex&identifier",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                "Active"
              ],
              "query": [
                {
                  "key": "pageSize",
                  "value": "50"
                },
                {
                  "key": "pageIndex",
                  "value": null
                },
                {
                  "key": "identifier",
                  "value": null
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Active by Identity",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "method": "GET",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/Container?uuid=41a4e6cd-ba74-4dd0-ad26-8291b4153582&active=true",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                "Container"
              ],
              "query": [
                {
                  "key": "identifier",
                  "value": "RouteA",
                  "disabled": true
                },
                {
                  "key": "uuid",
                  "value": "41a4e6cd-ba74-4dd0-ad26-8291b4153582"
                },
                {
                  "key": "active",
                  "value": "true"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Active Count",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  "let moment = require(\"moment\")\r",
                  "\r",
                  "pm.variables.set(\"today\", moment().format())\r",
                  "pm.variables.set(\"today-24hours\", moment().subtract(\"24\", \"hour\").format())\r",
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n   \"startdate\": \"{{today-24hours}}\",\r\n   \"enddate\": \"{{today}}\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/Active/Count",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                "Active",
                "Count"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Parent",
      "item": [
        {
          "name": "Create Parent ( Physical )",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            },
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"ParentIdentifier\": \"{{SHIPMENTNUMBER}}\",\r\n    \"ChildrenIdentifier\": [\r\n        \"{{CHILD_SHIPMENTNUMBER_1}}\",\r\n        \"{{CHILD_SHIPMENTNUMBER_2}}\"\r\n    ],\r\n    \"DateCreated\": \"{{today}}\",\r\n    \"IsVirtualParent\": false,\r\n    \"MaxDaysOld\": 10,\r\n    \"EventCode\": \"111\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Create Parent ( Virtual )",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            },
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"ParentIdentifier\": \"{{$randomUUID}}\",\r\n    \"ChildrenIdentifier\": [\r\n        \"{{CHILD_SHIPMENTNUMBER_1}}\",\r\n        \"{{CHILD_SHIPMENTNUMBER_2}}\"\r\n    ],\r\n    \"DateCreated\": \"{{today}}\",\r\n    \"IsVirtualParent\": true,\r\n    \"MaxDaysOld\": 10,\r\n    \"EventCode\": \"111\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Close Parent",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/:Uuid/Close",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                ":Uuid",
                "Close"
              ],
              "variable": [
                {
                  "key": "Uuid",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Lock Parent",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/:uuid/Lock",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                ":uuid",
                "Lock"
              ],
              "variable": [
                {
                  "key": "uuid",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Unlock Parent",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/:Uuid/Unlock",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                ":Uuid",
                "Unlock"
              ],
              "variable": [
                {
                  "key": "Uuid",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Add Event To Parent",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n  \"EventCode\" : \"111\",\r\n  \"DateCreated\" : \"{{today}}\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/:Uuid/Events",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                ":Uuid",
                "Events"
              ],
              "variable": [
                {
                  "key": "Uuid",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Children From Parent",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            },
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/:Uuid/Children",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                ":Uuid",
                "Children"
              ],
              "variable": [
                {
                  "key": "Uuid",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Children Count From Parent",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/:Uuid/Children/Count",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                ":Uuid",
                "Children",
                "Count"
              ],
              "variable": [
                {
                  "key": "Uuid",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Children",
      "item": [
        {
          "name": "Add To Parent",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "PUT",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"ChildrenIdentifier\": [\r\n        \"{{CHILD_SHIPMENTNUMBER_3}}\"\r\n    ],\r\n    \"DateCreated\": \"{{today}}\",\r\n    \"MaxDaysOld\": 15,\r\n    \"EventCode\": \"111\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/:Uuid",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                ":Uuid"
              ],
              "variable": [
                {
                  "key": "Uuid",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Parent From Child",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "method": "GET",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Containers/Children/:Identifier",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Containers",
                "Children",
                ":Identifier"
              ],
              "variable": [
                {
                  "key": "Identifier",
                  "value": "bea19fec-7f10-4c8f-a3d5-0a5d4acf314b"
                }
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Settings",
      "item": [
        {
          "name": "Get Owner Settings",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Settings",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Settings"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Update Owner Settings",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "PUT",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"ClosingOption\": false\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "https://api.nshiftportal.com/track/containers/Container/Settings",
              "protocol": "https",
              "host": [
                "api",
                "nshiftportal",
                "com"
              ],
              "path": [
                "track",
                "containers",
                "Container",
                "Settings"
              ]
            }
          },
          "response": []
        }
      ]
    }
  ],
  "auth": {
    "type": "oauth2",
    "oauth2": [
      {
        "key": "accessTokenUrl",
        "value": "https://account.nshiftportal.com/idp/connect/token",
        "type": "string"
      },
      {
        "key": "client_authentication",
        "value": "body",
        "type": "string"
      },
      {
        "key": "clientSecret",
        "value": "{{CLIENT_SECRET}}",
        "type": "string"
      },
      {
        "key": "clientId",
        "value": "{{CLIENT_ID}}",
        "type": "string"
      },
      {
        "key": "grant_type",
        "value": "client_credentials",
        "type": "string"
      },
      {
        "key": "tokenName",
        "value": "container_api_token",
        "type": "string"
      },
      {
        "key": "addTokenTo",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "requests": {},
        "exec": [
          "let moment = require(\"moment\")",
          "pm.variables.set(\"today\", moment().format())"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "requests": {},
        "exec": [
          ""
        ]
      }
    }
  ]
}