If you are most familiar with REST APIs, you’re probably used to creating/updating/deleting records using different endpoints (i.e., POST /article, PUT /article/slug, DELETE /article/slug). There’s nothing wrong with that! 8base’s GraphQL operations open up some pretty cool abilities though that you may not have expected to work as they do.
Did you know you can create two records in two separate tables using one GraphQL operation? Meanwhile, the relationship between them gets set up exactly as is defined in your data model.
We’re not only creating a new campaign record using the campaignCreate operation in the mutation above, but also an invoice record. Since the invoice is being created through the campaign relationship, the association of these two new records will be handled automatically. Boom