Skip to content

What's the secret to uploading images? #36

@petered

Description

@petered

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions