Product Updates

DatoCMS changelog for new features and general improvements
API Clients

Released v0.5.4 of JS client

June 27th, 2018

We just rolled version 0.5.4 of our JS client!

The big change is that the methods the client makes available are generated at runtime based on the JSON Schema of our CMA. This means any new API endpoint — or changes to existing ones — will instantly be reflected to the client, without the need to upgrade to the latest client version.

We also added a new deserializeResponse option to every call, that you can use if you want to retrieve the exact payload the DatoCMS returns:

1
import { SiteClient } from 'datocms-client';
2
3
const client = new SiteClient("YOUR-API-KEY")
4
5
// `deserializeResponse` is true by default:
6
const accessToken = client.accessTokens.create({
7
name: "New token",
8
role: "34"
9
})
10
11
// {
12
// id: "312",
13
// hardcodedType: null,
14
// name: "New token",
15
// token: "XXXX",
16
// role: "34"
17
// }
18
19
// if `deserializeResponse` is false, this will be the result
20
const accessToken = client.accessTokens.create(
21
{
22
name: "New token",
23
role: "34"
24
},
25
{
26
deserializeResponse: false
27
}
28
)
29
30
// {
31
// data: {
32
// type: "access_token",
33
// id: "312",
34
// attributes: {
35
// name: "New token",
36
// token: "XXXX",
37
// hardcoded_type: nil
38
// },
39
// relationships: {
40
// role: {
41
// data: {
42
// type: "role",
43
// id: "34"
44
// }
45
// }
46
// }
47
// }
48
// }

In our doc pages we also added some examples for the super-handy allPages option which was already present since v0.3.29:

// if you want to fetch all the pages with just one call:
client.items.all({ "filter[type]" => "44" }, { allPages: true })
Start using DatoCMS today
According to Gartner 89% of companies plan to compete primarily on the basis of customer experience this year. Don't get caught unprepared.
  • No credit card
  • Easy setup
Subscribe to our newsletter! 📥
One update per month. All the latest news and sneak peeks directly in your inbox.
support@datocms.com ©2024 Dato srl, all rights reserved P.IVA 06969620480