Skip to content

Instantly share code, notes, and snippets.

@akeaswaran
Last active March 5, 2018 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akeaswaran/8e65e499825fdb3a5be3a0e947899aeb to your computer and use it in GitHub Desktop.
Save akeaswaran/8e65e499825fdb3a5be3a0e947899aeb to your computer and use it in GitHub Desktop.
MLS GraphQL API Docs

Interacting with MLS GraphQL API

For GraphQL response, send POST request to https://golazo-ql.mlsdigital.net/graphql using PostMan with following headers:

Content-Type:application/json
Accept:application/json

and following request body:

query:query PostGameExtension($id:Float!){match(id:$id){slug home{match{form}name{abbreviation}} away{match{form}name{abbreviation}}venue{venue:name city state country}highlights{image_uri labels}recap{full:full_title short:teaser_title webpageUrl:webpage_url}}}
variables:{"id":965464}
operationName:PostGameExtension

Unminified query:

query PostGameExtension($id: Float!) {
    match(id: $id) {
        slug
        home {
            match {
                form
            }
            name {
                abbreviation
            }
        }
        away {
            match {
                form
            }
            name {
                abbreviation
            }
        }
        venue {
            venue: name
            city
            state
            country
        }
        highlights {
            image_uri
            labels
        }
        recap {
            full: full_title
            short: teaser_title
            webpageUrl: webpage_url
        }
    }
}

Sample response:

{
    "data": {
        "match": {
            "slug": "2018-03-04-la-galaxy-vs-portland-timbers",
            "home": {
                "match": {
                    "form": [
                        "W",
                        "L",
                        "W",
                        "D",
                        "D"
                    ]
                },
                "name": {
                    "abbreviation": "LA"
                }
            },
            "away": {
                "match": {
                    "form": [
                        "L",
                        "L",
                        "D",
                        "W",
                        "W"
                    ]
                },
                "name": {
                    "abbreviation": "POR"
                }
            },
            "venue": {
                "venue": "StubHub Center",
                "city": "Carson",
                "state": "CA",
                "country": "USA"
            },
            "highlights": [
                {
                    "image_uri": "https://img.mlsdigital.net/www.mlssoccer.com/7/image/319332/original.jpg",
                    "labels": [
                        "Full Highlights",
                        "Match Highlights"
                    ]
                },
                {
                    "image_uri": "https://img.mlsdigital.net/www.mlssoccer.com/7/image/319324/original.jpg",
                    "labels": [
                        "Match Highlights"
                    ]
                },
                {
                    "image_uri": "https://img.mlsdigital.net/www.mlssoccer.com/7/image/319316/original.jpg",
                    "labels": [
                        "ESPN",
                        "Goals",
                        "Match Highlights"
                    ]
                },
                {
                    "image_uri": "https://img.mlsdigital.net/www.mlssoccer.com/7/image/319303/original.jpg",
                    "labels": [
                        "ESPN",
                        "Goals",
                        "Match Highlights"
                    ]
                },
                {
                    "image_uri": "https://img.mlsdigital.net/www.mlssoccer.com/7/image/319299/original.jpg",
                    "labels": [
                        "ESPN",
                        "Goals",
                        "Match Highlights"
                    ]
                }
            ],
            "recap": {
                "full": "LA Galaxy 2, Portland Timbers 1 | 2018 MLS Match Recap",
                "short": "LA 2, POR 1: Rebuilt Galaxy outlast Timbers",
                "webpageUrl": "https://www.mlssoccer.com/post/2018/03/05/la-galaxy-2-portland-timbers-1-2018-mls-match-recap"
            }
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment