Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the secret to uploading images? #85

Open
petered opened this issue Aug 10, 2024 · 1 comment
Open

What's the secret to uploading images? #85

petered opened this issue Aug 10, 2024 · 1 comment

Comments

@petered
Copy link

petered commented Aug 10, 2024

Hey CalTopo-python-er(s),

Has anyone figured out the secret to uploading images?

From what I can tell, it's a 3-step dance.

  1. POST request to https://caltopo.com/api/v1/media/<UUID_FOR_IMAGE> with a json payload {"properties":{"creator":"<USER_ID>","filename":"test_image.jpg","exifCreatedTZ":"America/Vancouver"}}

  2. POST request to https://caltopo.com/api/v1/media/<UUID_FOR_IMAGE>/data with the json payload {"data":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBw0NDQ0.... <BIG LONG URL-SAFE BASE64-ENCODED IMAGE> ...}

  3. POST request to https://caltopo.com/api/v1/map/<MAP_ID>/MapMediaObject containing the marker object, with reference to the image {"type":"Feature","id":null,"geometry":{"type":"Point","coordinates":[<LONGITUDE>,<LATITUDE>]},"properties":{"parentId":"","backendMediaId":"<UUID_FOR_IMAGE>","title":"test_image.jpg","heading":null,"description":"","marker-symbol":"aperture","marker-color":"#FFFFFF","marker-size":1}}

Step 1 works..
But I'm stuck at step 2 - getting a 500 server error in the response, and am at a bit of a loss as to why..

I'm working in Kotlin - otherwise I'd just post the code as a branch here.

Thanks all for any input! Will post the solution if I find it.

@caver456
Copy link
Contributor

caver456 commented Aug 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants