osmlab / maproulette-python-client

MapRoulette Client Library for Python
https://maproulette-python-client.readthedocs.io
Apache License 2.0
11 stars 12 forks source link

Add support for the endpoint /challenge/{id}/addFileTasks, closes #83 #84

Closed rYR79435 closed 2 years ago

rYR79435 commented 3 years ago

This is my shot at implementing the endpoint I requested in #83.

I have used the swagger documentation for this.

Unfortuantely the API always returns maproulette.api.errors.InvalidJsonError: {'status': 400, 'message': 'Invalid JSON payload.'} no matter what I try. I have depleted my ideas for how to fix this, hence I'm creating this draft in hopes someone can help me.

Some notes:

Here's a gist with example data: https://gist.github.com/rYR79435/08f2835ae1876c1e8c5ed8968cce208e

rYR79435 commented 3 years ago

I figured out what the problem was. The API expects the file to be named 'json'.

I did so via this line in the MR frontend: https://github.com/osmlab/maproulette3/blob/e785c0e49af2b0bfcd9ffadbcbb199da6cca2ee5/src/services/Challenge/Challenge.js#L1020

rYR79435 commented 3 years ago

Sure thing! Thank you for reviewing.