Users special parameters requests

Every find and findAll endpoint in our Ordering API allows parameters request.

In Users there are some parameters which are considered special params, these work with params:attribute and are used to obtain specific data needed.

🚧

Extra parameters for each endpoint and are not part of the same model attributes, only for find and findAll.

The attributes that are used for special requests are listed below:

  • addresses
  • dropdown_option
  • driver_groups
  • driver_groups.name
  • assigned_orders_count
  • history

Addresses

This param is used to obtain users showing only the addresses attribute.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/users?params=addresses
[
  {
    "id": 4,
    "addresses": [
      {
        "id": 1,
        "user_id": 4,
        "name": "testFpostman",
        "lastname": "oiuytr",
        "address": "calle 5 n5 55",
        "address_notes": null,
        "phone": null,
        "cellphone": null,
        "zipcode": null,
        "location": null,
        "default": false
      },
      {
        "id": 2,
        "user_id": 4,
        "name": "testFpostman",
        "lastname": "oiuytr",
        "address": "calle 5 n5 55",
        "address_notes": null,
        "phone": null,
        "cellphone": null,
        "zipcode": null,
        "location": null,
        "default": false
      },
      {
        "id": 3,
        "user_id": 4,
        "name": "testFpostman",
        "lastname": "oiuytr",
        "address": "calle 5 n5 55",
        "address_notes": null,
        "phone": null,
        "cellphone": null,
        "zipcode": null,
        "location": null,
        "default": false
      }
      ...
    ]
  }
  ...
]

Dropdown options

This parameter is used to obtain users with only the dropdown_option attribute.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/users?params=dropdown_option_id
[
  {
    "id": 3,
    "dropdown_option_id": null
  },
  {
    "id": 4,
    "dropdown_option_id": null
  },
  {
    "id": 8,
    "dropdown_option_id": null
  },
  {
    "id": 9,
    "dropdown_option_id": null
  },
  {
    "id": 1,
    "dropdown_option_id": 0
  },
  {
    "id": 2,
    "dropdown_option_id": 0
  }
]

Driver groups

This parameter is used to obtain users with only the driver_groups attribute.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/users?params=driver_groups.
[
  {
      "id": 33,
      "drivergroups": [
          {
              "id": 1,
              "administrator_id": 5,
              "name": "Driver Group Demo",
              "enabled": true,
              "pivot": {
                  "driver_id": 33,
                  "driver_group_id": 1
              },
              "business": [
                  {
                      "id": 3,
                      "pivot": {
                          "driver_group_id": 1,
                          "business_id": 3
                      }
                  },
                ...
              ]
          },
        ...
      ]
  },
  ... //if findAll
]

Example:
-https://apiv4.ordering.co/v400/en/demo/users/9?params=driver_groups,id

{
  "id": 9,
  "drivergroups": [
    {
      "id": 1,
      "administrator_id": 8,
      "name": "Driver Group Demo",
      "enabled": true,
      "pivot": {
        "driver_id": 9,
        "driver_group_id": 1
      },
      "business": [
        {
          "id": 3,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 3
          }
        },
        {
          "id": 7,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 7
          }
        },
        {
          "id": 18,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 18
          }
        },
        {
          "id": 19,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 19
          }
        },
        {
          "id": 20,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 20
          }
        },
        {
          "id": 21,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 21
          }
        },
        {
          "id": 22,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 22
          }
        },
        {
          "id": 23,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 23
          }
        },
        {
          "id": 24,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 24
          }
        },
        {
          "id": 25,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 25
          }
        },
        {
          "id": 26,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 26
          }
        },
        {
          "id": 27,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 27
          }
        },
        {
          "id": 36,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 36
          }
        },
        {
          "id": 37,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 37
          }
        },
        {
          "id": 38,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 38
          }
        },
        {
          "id": 39,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 39
          }
        },
        {
          "id": 41,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 41
          }
        },
        {
          "id": 47,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 47
          }
        },
        {
          "id": 48,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 48
          }
        },
        {
          "id": 49,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 49
          }
        },
        {
          "id": 50,
          "pivot": {
            "driver_group_id": 1,
            "business_id": 50
          }
        }
      ]
    }
  ]
},

History

This parameter is used to obtain users with only the history attribute.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/users?params=history
[
    {
        "id": 4,
        "history": [
            {
                "id": 71,
                "user_id": 4,
                "type": 2,
                "data": null,
                "created_at": "2018-07-03 22:37:16",
                "updated_at": "2018-07-03 22:37:16"
            },
          ...
        ]
    }
  ...
]