1

Python : error 4 on create Order

Topic: Python : error 4 on create Order

Hi,

got this code :

          params = {
          'n' : str(name),
          'p' : {},
          'u' : int(unit_id),
          'tf': tf,
          'tt': tt,
          'callMode' : 'create',
          'x' : float(x),
          'y' : float(y),
          'itemId' : 123456789,
          'id': 0

        }
        logger.info("%s", pprint.pformat(params))
        result = wialon_api.call('order/update',params)

1. token is good and i can login
2. calling  result = wialon_api.avl_evts() gives the last events
3. 123456789 is my driver Id

i always get  :

WialonError(Invalid input order/update (4))

how to know which value is wrong?
how to know which params are necessary and which one are optionals?

Thanks

Said Lokhat

2

Python : error 4 on create Order

(edited by namo 12/09/2016 16:40:45)

Re: Python : error 4 on create Order

Hello Said!
You should pass two more obligatory fields in params json:
f - order flags (uint)
r - order point radius, m (uint)
See here for details: https://sdk.wialon.com/wiki/en/sidebar/ … der/update

3

Python : error 4 on create Order

Re: Python : error 4 on create Order

Hi,
Thank you
but still i have filled all fields i continue to have error 4

is it possible (humble request) for Gurtam to add more error info under the response (error = 4 is not really clear)
Ex : which field is missing or wrong value

Thanks

4

Python : error 4 on create Order

Re: Python : error 4 on create Order

Hello Said!
Below is an example of params json that worked for me:

params={
    "id": 0,                               // you should pass id:0 when create new order
    "n": "order name",
    "p": {
    },
    "f": 1,                                 // order flags
    "tf": 1473699600,              // time from
    "tt": 1473785940,              // time to
    "r": 100,                             // order point radius
    "y": 52.32785916380962, // latitude
    "x": 9.79731559753418,   // longitude
    "itemId": 80507,                // resourceId
    "callMode": "create"
}

Also you should check that "time from" and "time to" in your request comply with condition  tf < tt. Otherwise you will get {error:4} response.