Troubles with API for bulk uploads to update building attributes #1196
-
Hello everybody @tomalrussell @matkoniecz , I just try to update some building attributes from a python script via API. So, I tried it with your provided way to update buildings but all the time I only get the error response: For all GET requests it worked fine, also from the same python script. But POST for update buildings is not working. you will find my current script below.
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
for the new JSON data_upload I took a previously accessed JSON data via GET /buildings/{}.json and just edited manually the field for 'location_name' into 'TESTDATA'. Everything else I kept from the GET request. |
Beta Was this translation helpful? Give feedback.
-
@tomalrussell @matkoniecz Now, I use only http for API requests, and for POST buildings I get now code 200, but the edit of building attribute is not successful. So, the data will not be changed. If I do a API request /login I get the response if I use https like I did before, I get for /login the userid as a response. But the initially described server error 500 for POST /buildings/{id].json How can I use also POST requests with https API-URL ? thanks a lot : ) |
Beta Was this translation helpful? Give feedback.
-
I also tried the original script https://github.com/colouring-cities/colouring-london/blob/54a40d3d8c07af5b90d0c3f979a0c561e0f931b6/etl/join_building_data/load_csv.py to run it against Colouring Dresden Staging Env (and also against Colouring London API), but I got just status code 200 (OK) but without any changes for builiding attributes. What could I do better? cheers |
Beta Was this translation helpful? Give feedback.
-
hi @traveller195 sorry we've not been able to get back @mdsimpson42 @tomalrussell @matkoniecz could anyone possibly help IOER out here? |
Beta Was this translation helpful? Give feedback.
-
so, I got the solution: I was wrong when a wrote that POST requests (with read-access) could be out of work because of upgrade from http to https --> because all saved edits by the users are POST requests, as well. Not only bulk uploads... thats why, I analyzed those successful requests made by the frontend within the developer tools of the browser. so, I found out that the JSON structure for the POST request is different, indeed. It is divided into 'attributes' and 'user_attributes' and fits so the structure of the datafields of the API. the second change I made is to include a /login API request first in a session. Both changes together worked now for me, so I am really happy to update building attributes from a python script using the API |
Beta Was this translation helpful? Give feedback.
so, I got the solution:
I was wrong when a wrote that POST requests (with read-access) could be out of work because of upgrade from http to https --> because all saved edits by the users are POST requests, as well. Not only bulk uploads...
thats why, I analyzed those successful requests made by the frontend within the developer tools of the browser.
so, I found out that the JSON structure for the POST request is different, indeed. It is divided into 'attributes' and 'user_attributes' and fits so the structure of the datafields of the API.
the second change I made is to include a /login API request first in a session.
Both changes together worked now for me, so I am really happy to updat…