Skip to content

TODO: Use GraphQL query to fetch username #1

Description

@bgo-eiu

User eserte on the Mapillary forums provided a helpful reference point on how to go about retrieving username info for an image in the absence of an API solution: https://forum.mapillary.com/t/bugreport-image-author-info-unavailable-in-the-new-api/4994/8

The call is a POST request against https://graph.mapillary.com/graphql
The post content is
$post_content = 'doc=query%20FetchImages(%24imageIds%3A%20%5BID!%5D)%20%7B%0A%20multifetch__MapImage(ids%3A%20%24imageIds)%20%7B%0A%20node%20%7B%0A%20altitude%0A%20atomic_scale%0A%20camera_parameters%0A%20camera_type%0A%20captured_at%0A%20compass_angle%0A%20computed_altitude%0A%20computed_compass_angle%0A%20computed_rotation%0A%20creator%20%7B%0A%20id%0A%20username%0A%20%7D%0A%20exif_orientation%0A%20height%0A%20id%0A%20merge_cc%0A%20mesh%20%7B%0A%20id%0A%20url%0A%20%7D%0A%20owner%20%7B%0A%20id%0A%20%7D%0A%20quality_score%0A%20sfm_cluster%20%7B%0A%20id%0A%20url%0A%20%7D%0A%20thumb(size%3ASIZE_2048)%20%7B%0A%20id%0A%20url%0A%20%7D%0A%20width%0A%20%7D%0A%20node_id%0A%20%7D%0A%7D&variables=%7B%0A%20%22imageIds%22%3A%20%5B%0A%20' . $start_id . '%0A%20%5D%0A%7D'
where $start_id is the image id. Also don’t forget to send an Authorization HTTP header; a possibility is to look into Web Inspector while using the Mapillary Web UI and use the same header as there.
Response is a somewhat complex JSON, the path to the username is something like
$data->{data}->{"multifetch__MapImage"}->[0]->{node}->{creator}->{username}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions