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

TODO: Use GraphQL query to fetch username #1

Open
bgo-eiu opened this issue Mar 20, 2022 · 0 comments
Open

TODO: Use GraphQL query to fetch username #1

bgo-eiu opened this issue Mar 20, 2022 · 0 comments
Labels
tasks TODO

Comments

@bgo-eiu
Copy link
Owner

bgo-eiu commented Mar 20, 2022

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}

@bgo-eiu bgo-eiu added the tasks TODO label Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tasks TODO
Projects
None yet
Development

No branches or pull requests

1 participant