Parameter 'locations' has incorrect value or format

I am trying to use API for Django REST Framework project purpose, more precisely - to calculate distance between 2 cities (in the essence - between airports of such cities).
here is entire code - @staticmethod def get_coordinates(source, destination): source - Pastebin.com
in case when I have 2 cities, from first method I have got 2 coordinates:
Santa Barbara - [-95.361416, 29.784753]
Houston - [-91.570956, 43.759028]

when I try to use this coordinates in my second method like this -
payload = {‘locations’: [source_coordinates, destination_coordinates]}
I receive the following announcement - “Parameter ‘locations’ has incorrect value or format.”

I don’t understand what is mistake and what I have done wrong and how to make all the necessary corrections.

I acutely need help with this issue, so please if you know what is the root of this problem please help me.

Thank you in advance.

Just a small amendment to question - I tried to flip coordinates in coordinates’ lis for each city. But unfortunately it showed another mistake - “message”:“Source point(s) [0, 1] out of bounds: -95.361416,29.784753; -91.570956,43.759028. Destination point(s) [0, 1] out of bounds: -95.361416,29.784753; -91.570956,43.759028”}

So as far as i undestood it’s complex mistake. I suspect initial geo coordinates for each city (source, destionation) are calculated mistakenely cuz they as put in wrong order in list and in addition they are not correct.

So, how can I fix this mistake?

Hey,

the error is stating that what you pass as locations in your body is not correctly formatted.
According to our API Docs, this should be an array of arrays, e.g.

{“locations”:[[9.70093,48.477473],[9.207916,49.153868],[37.573242,55.801281],[115.663757,38.106467]]}

Make sure that your expression

evaluates to this format.

Best regards