---
title: Get latest treatment for each type of Medication
slug: import-test-pdf/get-latest-treatment-for-each-type-of-medication
createdAt: 2025-10-28T16:28:34.266Z
---

{
  "id": "Hvu5WTmPvWP52nYgXFaxC",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "/api/v1/pets/{id}/medications",
    "servers": [],
    "name": "Get latest treatment for each type of Medication",
    "description": "Returns the list of Medication for Pet",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "data",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": [
                  {
                    "name": "dietsTatus",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "modelRef": "#/components/schemas/PeriodicalTreatment",
                    "customType": "PeriodicalTreatment[]",
                    "schema": [
                      {
                        "name": "id",
                        "kind": "optional",
                        "type": "integer",
                        "description": "",
                        "example": 1
                      },
                      {
                        "name": "pet_id",
                        "kind": "optional",
                        "type": "integer",
                        "description": "",
                        "example": 1
                      },
                      {
                        "name": "file_id",
                        "kind": "optional",
                        "type": "integer",
                        "description": "",
                        "example": 1
                      },
                      {
                        "name": "product_id",
                        "kind": "optional",
                        "type": "integer",
                        "description": "",
                        "example": 1
                      },
                      {
                        "name": "treatment_mapping_id",
                        "kind": "optional",
                        "type": "integer",
                        "description": "",
                        "example": 1
                      },
                      {
                        "name": "fileCase",
                        "kind": "optional",
                        "type": "object",
                        "description": "",
                        "modelRef": "#/components/schemas/Record",
                        "customType": "Record",
                        "schema": [
                          {
                            "name": "id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1
                          },
                          {
                            "name": "number",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "175"
                          },
                          {
                            "name": "status",
                            "kind": "optional",
                            "type": "integer",
                            "description": "`0` - Draft `1` - Saved `2` - Closed `3` - Hospitalized\n",
                            "example": 1
                          },
                          {
                            "name": "vet_id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1
                          },
                          {
                            "name": "clinic_id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1
                          },
                          {
                            "name": "pet_id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1
                          },
                          {
                            "name": "sale_id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1
                          },
                          {
                            "name": "date",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "2021-11-19"
                          },
                          {
                            "name": "reason",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "Routine checkup"
                          },
                          {
                            "name": "template_id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 0
                          },
                          {
                            "name": "comments",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": ""
                          },
                          {
                            "name": "recommendations",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": ""
                          },
                          {
                            "name": "rabic_tag_number",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": ""
                          },
                          {
                            "name": "presumptive_diagnosis",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": ""
                          },
                          {
                            "name": "diagnosis",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": ""
                          },
                          {
                            "name": "treatment",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": ""
                          }
                        ]
                      },
                      {
                        "name": "treatment",
                        "kind": "optional",
                        "type": "object",
                        "description": "",
                        "example": "",
                        "schema": [
                          {
                            "name": "id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1
                          },
                          {
                            "name": "type",
                            "kind": "optional",
                            "type": "string<Treatment | SoldServicePackageProduct | SoldServicePackage | HistoricalTreatment>",
                            "description": "",
                            "example": "Treatment"
                          },
                          {
                            "name": "product_name",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "Nobivac Rabies"
                          },
                          {
                            "name": "tag_number",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "123456789"
                          },
                          {
                            "name": "batch_no",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "tr22"
                          },
                          {
                            "name": "expiration_date",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "2022-01-01"
                          },
                          {
                            "name": "product_manufacturer",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": ""
                          },
                          {
                            "name": "administration_date",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "2021-11-19"
                          },
                          {
                            "name": "due_date",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "2022-11-19"
                          },
                          {
                            "name": "product_category_id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1
                          }
                        ]
                      },
                      {
                        "name": "certificates",
                        "kind": "optional",
                        "type": "array",
                        "description": "",
                        "modelRef": "#/components/schemas/PrintedFileCertificate",
                        "customType": "PrintedFileCertificate[]",
                        "schema": [
                          {
                            "name": "id",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 9
                          },
                          {
                            "name": "printed_file",
                            "kind": "optional",
                            "type": "object",
                            "description": "",
                            "modelRef": "#/components/schemas/PrintedFile",
                            "customType": "PrintedFile",
                            "schema": [
                              {
                                "name": "id",
                                "kind": "optional",
                                "type": "integer",
                                "description": "",
                                "example": 9
                              },
                              {
                                "name": "name",
                                "kind": "optional",
                                "type": "string",
                                "description": "",
                                "example": ""
                              },
                              {
                                "name": "title",
                                "kind": "optional",
                                "type": "string",
                                "description": "",
                                "example": "Rabies Certificate For Daisy"
                              },
                              {
                                "name": "real_name",
                                "kind": "optional",
                                "type": "string",
                                "description": "",
                                "example": "Rabies Certificate For Daisy.pdf"
                              },
                              {
                                "name": "printable_file_id",
                                "kind": "optional",
                                "type": "string",
                                "description": "",
                                "example": "1086"
                              },
                              {
                                "name": "vet_id",
                                "kind": "optional",
                                "type": "string",
                                "description": "",
                                "example": "1568"
                              },
                              {
                                "name": "patient_id",
                                "kind": "optional",
                                "type": "string",
                                "description": "",
                                "example": "316635"
                              },
                              {
                                "name": "created_at",
                                "kind": "optional",
                                "type": "string",
                                "description": "",
                                "example": "2021-11-19T13:40:23.000000Z"
                              }
                            ]
                          },
                          {
                            "name": "created_at",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "2021-11-19T13:40:23.000000Z"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url /api/v1/pets/{id}/medications \\\n     --header 'accept: application/json'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/api/v1/pets/{id}/medications\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/api/v1/pets/{id}/medications\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/api/v1/pets/{id}/medications\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful operation\n{\n  \"data\": {\n    \"dietsTatus\": [\n      {\n        \"id\": 1,\n        \"pet_id\": 1,\n        \"file_id\": 1,\n        \"product_id\": 1,\n        \"treatment_mapping_id\": 1,\n        \"fileCase\": {\n          \"id\": 1,\n          \"number\": \"175\",\n          \"status\": 1,\n          \"vet_id\": 1,\n          \"clinic_id\": 1,\n          \"pet_id\": 1,\n          \"sale_id\": 1,\n          \"date\": \"2021-11-19\",\n          \"reason\": \"Routine checkup\",\n          \"template_id\": 0,\n          \"comments\": \"\",\n          \"recommendations\": \"\",\n          \"rabic_tag_number\": \"\",\n          \"presumptive_diagnosis\": \"\",\n          \"diagnosis\": \"\",\n          \"treatment\": \"\"\n        },\n        \"treatment\": {\n          \"id\": 1,\n          \"type\": \"Treatment\",\n          \"product_name\": \"Nobivac Rabies\",\n          \"tag_number\": \"123456789\",\n          \"batch_no\": \"tr22\",\n          \"expiration_date\": \"2022-01-01\",\n          \"product_manufacturer\": \"\",\n          \"administration_date\": \"2021-11-19\",\n          \"due_date\": \"2022-11-19\",\n          \"product_category_id\": 1\n        },\n        \"certificates\": [\n          {\n            \"id\": 9,\n            \"printed_file\": {\n              \"id\": 9,\n              \"name\": \"\",\n              \"title\": \"Rabies Certificate For Daisy\",\n              \"real_name\": \"Rabies Certificate For Daisy.pdf\",\n              \"printable_file_id\": \"1086\",\n              \"vet_id\": \"1568\",\n              \"patient_id\": \"316635\",\n              \"created_at\": \"2021-11-19T13:40:23.000000Z\"\n            },\n            \"created_at\": \"2021-11-19T13:40:23.000000Z\"\n          }\n        ]\n      }\n    ]\n  }\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}