Getting Started

Welcome! :wave: This guide helps you to understand the Mojito API and its functionality.

Introduction to GraphQL API

GraphQL is a query language for your API, it is a specification, a set of tools that operates over a single endpoint using HTTP, and a server-side runtime for executing queries by using a type system that you have defined for your data. Since GraphQL is not tied to any specific database or storage engine, it is backed by your existing code and data instead. To get you more familiar with GraphQL, below are the GraphQL data query terms you need to know.

GraphQL Data Query Terms

NameMeaning
A specificationThe specification determines the validity of a schema on the API server and the schema determines the validity of client calls.
Strongly typedThe schema defines an API's type system and all object relationships.
IntrospectiveA client can query the schema for details about the schema.
HierarchicalThe shape of a GraphQL call may mirror the shape of the JSON data that it returns. Nested fields let you query for and receive the only data you specify in a single round trip.
An application layerGraphQL is not a storage model or a database query language. The graph refers to graph structures defined in the schema, where nodes define objects and edges define relationships between objects. The API traverses and returns application data based on the schema definitions, independent of how the data is stored.

The Difference between GraphQL and REST APIs

GraphQL focuses on performance and flexibility optimization, therefore, it has advantages in development speed and consistency across all platforms. REST APIs on the other hand, is a software architectural style that defines a set of constraints for creating web services, it has an easier learning curve and has better familiarity than GraphQL.

Why Mojito is Using GraphQL?

Mojito API is using GraphQL as a query language to give you the flexibility to specify the data you need in your API requests and get exactly the specific data that you want. GraphQL also provides the same functionality as a bulk endpoint without recreating the endpoints, that way you will be able to combine multiple queries into one request and allow easier-to-understand queries. The benefit of using GraphQL is that it can eliminate both under and over-fetching data issues since it also allows you to control the set requests and responses.

How Do I Use Mojito's GraphQL API?

To use Mojito's GraphQL API, you would need to authenticate and get your access token. Details on the step-by-step can be seen here Authentication.

Once you get your access token, you can start querying our API. Below is the example request to get info on the collection name, items, and lot number from a known collection ID.

$ curl -X POST -H "Authorization: Bearer ACCESS_TOKEN" -H "Content-Type: application/graphql" https://api.mojito.xyz/query --data '
query {
  collection(id: "43432dasdx123") {
    id
    name
    items(limit: 2) {
      lot {
        lotNumber
      }
    }
  }
}

Below is the following response you will get.

{
  "data": {
    "collection": {
      "id": "43432dasdx123",
      "name": "Natively Digital 1.2",
      "items": [
        {
          "lot": {
            "lotNumber": 14
          }
        },
        {
          "lot": {
            "lotNumber": 35
          }
        }
      ]
    }
  }
}

Where Can I find All Mojito's API Queries, Mutations, and Schemas?

You can access the docs and schema in the Mojito GraphQL playground by clicking on the DOCS or SCHEMA tab on the right. It describes the available queries, mutations, or subscriptions.

You can also search it in this portal by entering Ctrl+/ or type any query that you are looking for on the search button on the top left corner.

Is There Any General Structure of Mojito's Data Model?

The general structure of our internal data model can be seen in the diagram below.

The organization is the root of all marketplaces, lots, and bids in the Mojito API. Marketplaces represent distinct marketplaces under your organization. Each marketplace has different collections representing different sales within that marketplace. Collections have collection items that are either an auction-style lot or a buy-it-now style lot. Within the auction-style lots, buyers can make bids.

Some GraphQL queries and mutations relate to the management of the marketplaces and lots and there are queries and mutations are related to making bids and purchases. The management APIs are meant to be used by our Mojito Manager Mint that you can access here, which will enable you to control your organizational data easily.

This data model also shows you the data flow creation that you need to do. For example, if you want to create an auction lot, here is the data flow creation that you need to do:

Create an organization > a marketplace > a collection > collection item > auction lot

To create those data, you can use our Mojito API or Mojito Mint (no-code platform). The details on how to create all of those via our Mojito API will be explained in the quickstart page here.

We can set you up with a test organization in our production environment. We will send an organization ID and also set up a test marketplace and send the marketplace ID. Those will be useful in setting up your application and targeting your organization in the Mojito API.

:email: Contact Us

For more information on our solution, please email us at [email protected].