About the use of map matching API

When I use the map matching API, I can select the. GPX file on the web page to calculate the results normally.
However, when I try to use the URL statement, I will feedback '{“code”: 400, “message”: “unable to process JSON”}
The following is my Python code. If you have any suggestions, I will be grateful!

headers = {
    'content-type': 'application/gpx+xml',
}
files = {'test.gpx':open('test.gpx', 'rb')}
url = 'http://localhost:8989/match?profile=car&type=json'
params = {
    'details': 'street_name',
    'points_encoded': 'FALSE'
}
response = requests.post(url, headers=headers, files=files,params=params)

as my understanding of requests you could try

response = requests.post(url, headers=headers, files=files, json=params)

Currently (and unfortunately) all the query parameters have to go into the URL like it is done for a GET request against /route. Only the XML file should be in the body of the POST request.

Thank you for your suggestions! This problem has now been solved.

I read the GPX file into a string format, using

response = requests Post (URL, headers = headers, data = gpx_str, params = params)

`
can successfully obtain the results

Powered by Discourse