Skip to main content
View as Markdown

Items

Fetch, create, update and delete the items of an event and their categories. An item can be a product, a project, a job offer and so on.

Items are products in the API: the objects are Product and ProductCategory. Each item belongs to a category, and you can link it to one or more exhibitors.

Reference: Product object, ProductCategory object

On this page you can:

Before you begin​

  • An API key, sent in the Authorization header. The key acts with the roles and permissions of the user who created it. See Authentication.
  • The ID of the event (eventId). See Events.
  • To create a product, the ID of its category. Create the category manually or with createProductCategoryV2.

Fetch products​

Use the event query with the products field to fetch the products of an event.

Get the first 100 products​

Fetch the first 100 products of an event, together with its product categories.

ArgumentDescription
eventIdThe ID of the event.
cursorPagination. first sets how many records to fetch per page.
Query
query EventProducts($eventId: ID!, $cursor: CursorPaginationInput!){
event(id: $eventId) {
productCategoriesV2{
totalCount
nodes {
id
name
}
}
products(cursor: $cursor) {
nodes {
clientIds
id
name
}
}
}
}
Variables
{
"eventId": "RXZlbnRfMQ==",
"cursor": {
"first": 100
}
}

Get the next 100 products​

To fetch the next page, send the query again and set cursor.after to the pageInfo.endCursor value of the previous response. Repeat while pageInfo.hasNextPage is true.

ArgumentDescription
eventIdThe ID of the event.
cursorPagination. first sets how many records to fetch per page; after is the cursor returned by the previous response.
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"
}
}

Get products by ID​

Fetch specific products.

ArgumentDescription
eventIdThe ID of the event.
filter.idsArray of the IDs of the products to fetch.
Query
query EventProducts($eventId: ID!, $filter: ProductFilterInput!) {
event(id: $eventId) {
products(filter: $filter) {
nodes {
clientIds
id
name
}
}
}
}
Variables
{
"eventId": "RXZlbnRfNDY1Njc4",
"filter": {
"ids":
[
"ProductID1",
"ProductID2"
]
}
}

Get products by category​

Fetch the products of one or more categories.

ArgumentDescription
eventIdThe ID of the event.
filter.parentCategoryIdsArray of the IDs of the categories.
Query
query EventProducts($eventId: ID!, $filter: ProductFilterInput!) {
event(id: $eventId) {
products(filter: $filter) {
nodes {
clientIds
id
name
}
}
}
}
Variables
{
"eventId": "RXZlbnRfNDY1Njc4",
"filter": {
"parentCategoryIds":
[
"ProductCategoryID1",
"ProductCategoryID2"
]
}
}

Create a product category​

Use the createProductCategoryV2 mutation to create a category, for example "Job Offers".

ArgumentDescription
eventIdThe ID of the event where you create the category.
nameThe name of the category in the event.
Mutation
mutation createProductCategory($input: CreateProductCategoryInput!) {
createProductCategoryV2(input: $input) {
errors {
code
message
}
productCategory {
id
name
}
}
}
Variables
{
"input" : {
"name":"Job Offers",
"eventId":"RXZlbnRfMQ==",
"imageUrl":"www.test.png",
"color": "blue",
"limit": 200
}
}

Create a product​

Use the createProduct mutation to create a product in a category, and optionally link it to exhibitors.

ArgumentDescription
eventIdThe ID of the event where you create the product.
categoryIdThe ID of the category of the product. The category must already exist: create it manually or with the createProductCategoryV2 mutation.
nameThe name of the product in the event.
clientIdYour own unique external ID for the product.
translationsThe name of the product in other languages.
Mutation
mutation createProduct($input: CreateProductInput!) {
createProduct(input: $input) {
product {
clientIds
customFields {
... on TextField {
id
locale
value
}
}
translations {
name
language
}
description
name
updatedAt
createdAt
exhibitors {
name
}
assetsUrls
}
errors {
message
}
}
}
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"
}],
"exhibitorIds": ["ExhibitorId"],
"assetsUrls": ["www.asset1.com", "www.asse2.com"]
}
}

Update a product category​

Use the updateProductCategoryV2 mutation to update a category.

ArgumentDescription
productCategoryIdThe ID of the category to update.
Mutation
mutation updateProductCategory($input: UpdateProductCategoryInput!) {
updateProductCategoryV2(input: $input) {
errors {
code
message
}
productCategory {
id
name
}
}
}
Variables
{
"input" : {
"name":"Job Offers New",
"imageUrl":"www.testnew.png",
"productCategoryId": "UHJvZHVjdENhdGVnb3J5XzEwMTY0MA=="
}
}

Update a product​

Use the updateProduct mutation to update a product, for example to change its category, exhibitors or custom fields.

ArgumentDescription
productIdThe Swapcard ID of the product to update.
categoryIdThe ID of the category of the product. The category must already exist: create it manually or with the createProductCategoryV2 mutation.
Mutation
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"}
}]
}
}

Delete products​

Use the deleteProducts mutation to delete one or more products. The response returns the IDs of the deleted products.

ArgumentDescription
productIdsArray of the IDs of the products to delete.
warning

Make sure you use the right product IDs and that you have the permission to delete these products.

Mutation
mutation deleteProducts($input: DeleteProductsInput!){
deleteProducts(input: $input) {
deletedProductIds
}
}
Variables
{
"input" : {
"productIds": [
"UHJvZHVjdF82MTQwMzY=",
"UHJvZHVjdG46MTQwMzY="
]
}
}

Requirements and constraints​

Check these points to avoid errors when you create or update products:

  • Use the right product ID.
  • You need the permission to update the product, and all the exhibitors linked to it.
  • Use a valid event ID and category ID.
  • name and nameTranslation: 255 characters maximum.
  • description and descriptionTranslation: 2,000 characters maximum.
  • A product can have up to 20 linked images.
  • Asset URLs must be valid.
  • Image URLs must not use http.
  • To link exhibitors, use valid exhibitor IDs.