All Release Notes

Updates to the GraphQL schema

28 August 2020
Composable Commerce
HTTP API
Enhancement
GraphQLExtensibility

Custom objects can now be created, updated, and deleted using the GraphQL API.

  • [GraphQL API] Added the following types to the GraphQL schema: CustomObject, CustomObjectDraft, CustomObjectQueryResult.
  • [GraphQL API] Changed the Query type:
    • Added the customObject field to the Query type.
    • Added the customObjects field to the Query type.
  • [GraphQL API] Changed the Mutation type:
    • Added the createOrUpdateCustomObject field to the Mutation type.
    • Added the deleteCustomObject field to the Mutation type.

Introduced the following changes to the GraphQL schema (in SDL format):

extend type Query {
customObject(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String, container: String): CustomObject
customObjects(where: String, sort: [String!], limit: Int, offset: Int, container: String!): CustomObjectQueryResult!
}
extend type Mutation {
createOrUpdateCustomObject(draft: CustomObjectDraft!): CustomObject
deleteCustomObject(version: Long,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String, container: String, personalDataErasure: Boolean = false): CustomObject
}
type CustomObject implements Versioned {
container: String!
key: String!
value: Json!
id: String!
version: Long!
createdAt: DateTime!
lastModifiedAt: DateTime!
createdBy: Initiator
lastModifiedBy: Initiator
}
input CustomObjectDraft {
key: String!
container: String!
"The value should be passed in a form of escaped JSON"
value: String!
version: Long
}
type CustomObjectQueryResult {
offset: Int!
count: Int!
total: Long!
results: [CustomObject!]!
}