What are the differences between the API versions?

Why a new API?

Our users use monday.com to manage everything. Marketing teams use it to keep track of assets getting passed from design to legal to their clients (and back). Manufacturing teams use it to better understand bottlenecks in their processes. Everyone uses it to create Llama Farms. 

As such, we realized that we needed to create an API that is as dynamic as our users' needs. It needed to be intuitive, expressive, and represent a lot of complicated data in a simple way. This is what our new API is. 

Why should I use the GraphQL API?

While our REST API was great, here are a couple of reasons why our GraphQL API is better. 

1. It's Simple

With GraphQL, you don't need to worry about managing multiple endpoints, each with a slightly different set of parameters. There's just one endpoint that you interact with in a consistent way, making it easy to get the data you need when you need it. 

2. It's Extensive

Our new API is built on the same infrastructure as our platform itself, which means it will be updated with new columns and data types very soon after they come out. While our last API was restricted to just 7 column types, you can now interact with all 25 (and counting) columns supported by our platform. 

3. It's Expressive

Tired of making more API calls than is necessary for your app's logic? That's what GraphQL succeeds at. Instead of having to run a new query every time you get a piece of data, you can combine queries to get data in as much granularity as you want, making your app more efficient and letting you focus on doing cool stuff with your code. 

What's the difference between the two APIs?

Our new API has a much simpler structure -- all the information for each call is enclosed in the body of a single POST request. No more worrying about HTTP verbs or keeping track of multiple URLs. 

You can also get data from the objects you return in one query, so you don't need to worry about sending a second query based on the data returned in the first. Less time spent waiting for a server, more time doing. 

As an example, let's say we want to create a number of items based on some data from a client database. 

In the old API, we would have to make a POST request for each entry, and then multiple PUT requests to populate each field for the entry. With GraphQL, we can do this in one call per entry, and use variables to populate the columns with minimal string manipulation: 

request.post({
    url : "http://api.monday.com/v2",
    json : true,
    headers : {
        "Authorization" : "YOUR_API_KEY_HERE"
    },
    body : {
        "query" : "mutation {
                      create_item(
                        item_name: "YOUR_ITEM_NAME"
                        board_id: BOARD_ID,
                        group_id: "topics",
                        column_values : "{"text" :"YOUR_DATA HERE"}"
                      ) {
                        id
                      }
                    }"
    }
}

 

Happy coding! 

If you have any questions about this or anything else in this article, feel free to reach out to us at customer success at support@monday.com