Getting started

Endpoint

melodyRepo is available for developer preview at the following endpoint:

https://api.melody.sh/graphql

Issuing queries

The handler will accept requests with the parameters:

  • query: A required string GraphQL document to be executed.
  • variables: JSON object of values to use for any GraphQL query variables.
  • operationName: The operation to run if query contains more than one query.

These variables can be specified either via a query-string, or the POST body:

/graphql?query=query+getPkg($n:String!){package(name:$n){name}}&variables={"n":"github.com/urfave/cli"}

A POST body will be processed based on the incoming Content-Type header:

  • application/json: Body will be parsed as a JSON object.
  • application/graphql: Body will be used as the query parameter with other parameters undefined.
  • application/x-www-form-urlencoded: Body will be parsed as a URL-encoded string of key-value pairs.

Parsing responses

melodyRepo will return query results in JSON format:

{
  "data": {
    "package": {
      "name": "github.com/urfave/cli"
    }
  }
}