Skip to main content

Items

The Item object can represent a Product, Project, Job Offer, etc in a Swapcard Event.

Object

Fetch first hundred Products(Items)

This query can be used to fetch the first 100 Products(Items) and the Product Categories.

Arguments

  • eventId - This is string value of the Event Id.

Query

query EventProducts($eventId: ID!, $cursor: CursorPaginationInput!){
event(id: $eventId) {
productCategories{
totalCount
nodes {
id
name
}
}
products(cursor: $cursor) {
nodes {
clientIds
id
name
}
}
}
}

Variables

{
"eventId": "RXZlbnRfMQ==",
"cursor": {
"first": 100
}
}

Fetch the next hundred Products(Items)

This query can be used to fetch the next 100 Products(Items).

Arguments

  • eventId - This is string value of the Event Id.

Query

query EventProducts($eventId: ID!, $cursor: CursorPaginationInput!) {
event(id: $eventId) {
products(cursor: $cursor) {
nodes {
clientIds
id
name
}
pageInfo {
hasNextPage
endCursor
}
}
}
}

Variables

{
"eventId": "RXZlbnRfMQ==",
"cursor": {
"first": 100,
"after": "INSERT_CURSOR_ID_HERE"
}
}

Fetch Products(Items) by Product Ids

This query can be used to fetch the Products by Product Ids.

Arguments

  • ids - The Ids of Products(Items) that need to searched. This is an array and can have multiple values separated by comma.

Query

query EventProducts($eventId: ID!, $filter: ProductFilterInput!) {
event(id: $eventId) {
products(filter: $filter) {
nodes {
clientIds
id
name
}
}
}
}

Variables

{
"eventId": "RXZlbnRfNDY1Njc4",
"filter": {
"ids":
[
"ProductID1",
"ProductID2"
]
}
}

Create Product(Item)

This mutation can be used to create a Product(Item).

Arguments

  • eventId - The Id of the Event on which the Product(Item) needs to be created.
  • categoryId - The Category Id to which the Product(Item) belongs. This needs to be already created either manually or via the mutation __Create Product(Item) Category __
  • name - The name of the Product(Item) in the Swapcard event.
  • clientId - This is a unique external id that can be assigned to each Product(Item).
  • translations - The translations of the Product(Item) in different languages.

Query

mutation createProduct($input: CreateProductInput!) {
createProduct(input: $input) {
product {
clientIds
customFields {
... on TextField {
id
locale
value
}
}
translations {
name
language
}
description
name
updatedAt
createdAt
}
}
}

Variables

{
"input" : {
"clientId": "Item1Id",
"name": "swapcard item",
"categoryId":"UHJvZHVjdENhdGVnb3J5XzEwMTYzOQ==" ,
"eventId":"RXZlbnRfMQ==",
"imageUrl":"www.test.png",
"description": "This is a swapcard item",
"customFields": [{
"definitionId": "RmllbGREZWZpbml==",
"text": {"language": "fr_FR", "value": "item"}
}],
"translations": [{
"name": "swapcard item",
"language": "en_US"
}]
}
}

Update Product(Item)

This mutation can be used to update a Product(Item).

Arguments

  • productId - This is a unique Product(Item) Id in Swapcard.
  • categoryId - The Category Id to which the Product(Item) belongs. This needs to be already created either manually or via the mutation __Create Product(Item) Category __

Query

mutation updateProduct($input: UpdateProductInput!) {
updateProduct(input: $input) {
errors {
code
message
}
product {
updatedAt
id
}
}
}

Variables

{
"input" : {
"productId": "UHJvZHVjdF82MTQwMjc=",
"categoryId":"UHJvZHVjdENhdGVnb3J5XzEwMTYzOQ==" ,
"exhibitorIds": ["RXhoaWJpdG9yXzY5MDUyNA=="],
"customFields": [{
"definitionId": "RmllbGREZWZpbml==",
"text": {"language": "fr_FR", "value": "Item updated"}
}]
}
}

Create Product(Item) Category

This mutation can be used to create an Product(Item) Category.

Arguments

  • eventId - The Id of the Event on which the Product Category needs to be created.
  • name - The name of the Product(Item) Category in the Swapcard event.

Query

mutation createProductCategory($input: CreateProductCategoryInput!) {
createProductCategory(input: $input) {
errors {
code
message
}
productCategory {
id
name
}
}
}
}

Variables

{
"input" : {
"name":"Job Offers",
"eventId":"RXZlbnRfMQ==",
"imageUrl":"www.test.png",
"color": "blue",
"limit": 200
}
}

Update Product(Item) Category

This mutation can be used to update an Product(Item) Category.

Arguments

  • productCategoryId - The Id of the Product Category that needs to be updated.

Query

mutation updateProductCategory($input: UpdateProductCategoryInput!) {
updateProductCategory(input: $input) {
errors {
code
message
}
productCategory {
id
name
}
}
}

Variables

{
"input" : {
"name":"Job Offers New",
"imageUrl":"www.testnew.png",
"productCategoryId": "UHJvZHVjdENhdGVnb3J5XzEwMTY0MA=="
}
}

Delete Products(Items)

This mutation can be used to delete Products(Items).

Arguments

  • productIds - The Ids of Products(Items) that need to be deleted. This is an array and can have multiple values separated by comma.

Query

mutation deleteProducts($input: DeleteProductsInput!){
deleteProducts(input: $input) {
deletedProductIds
}
}

Variables

{
"input" : {
"productIds": [
"UHJvZHVjdF82MTQwMzY=",
"UHJvZHVjdG46MTQwMzY="
]
}
}