Need help architecting or implementing a REST API? Book a call!

TypeScript SDK

Query Parameters

Learn how to include relations and work with soft deletes.

Including Relations

When building a query, you can instruct the API to include relations in the response.

const post = await Post.$query().with(['user', 'comments']).find(5); 

console.log(post.$relations.user);
console.log(post.$relations.comments);

Soft Deletes

Including Trashed Resources

const posts = await Post.$query().withTrashed().get();

Returning Only Trashed Resources

const posts = await Post.$query().onlyTrashed().get();

Copyright © 2019-2024 Aleksei Zarubin