cyclestreets / cyclestreets-r

An R interface to cyclestreets.net APIs
https://rpackage.cyclestreets.net/
GNU General Public License v3.0
27 stars 7 forks source link

Batch should auto-remove job after CSV download #48

Closed mvl22 closed 1 year ago

mvl22 commented 1 year ago

There is now an API call to remove the batch (including all data) rather than having it left lying about.

https://www.cyclestreets.net/api/v2/batchroutes.deletejob/

This should be added into the batch function, used after a successful CSV download.

Robinlovelace commented 1 year ago

Minimal test batch created, let's see if I can delete it as a test of this new functionality:

image

Robinlovelace commented 1 year ago

Heads-up @mvl22 it fails as follows:

Response [https://api.cyclestreets.net/v2/batchroutes.createjob?key=xxx]
  Date: 2023-02-17 21:59
  Status: 200
  Content-Type: application/json; charset=UTF-8
  Size: 77 B
{
    "error": "The name parameter is required, but has not been supplied."

Do you need to replace name with username in your code?

Robinlovelace commented 1 year ago

Success! As I suspected, passing both name and username fixed it.

image

Robinlovelace commented 1 year ago

Heads-up @mvl22 re-opening due to this error:

The geometry parameter is required, but has not been supplied.
mvl22 commented 1 year ago

Response [https://api.cyclestreets.net/v2/batchroutes.createjob?key=xxx] ... Do you need to replace name with username in your code?

Your example was using batchroutes.createjob not batchroutes.deletejob ...

batchroutes.deletejob definitely does not reference any name parameter, and that should be removed from your code.

mvl22 commented 1 year ago

The geometry parameter is required, but has not been supplied.

That parameter is only present in batchroutes.createjob. Please check your code is using the correct API call.