Skip to content

Latest commit

 

History

History
125 lines (105 loc) · 1.72 KB

examples_graphql_query_mutation.md

File metadata and controls

125 lines (105 loc) · 1.72 KB

Get inventories

Variable

{
  "request": {
    "pageIndex":1,
    "pageSize": 10
  }
}

Query

query getInventories($request: GetInventoriesRequestInput) {
  inventories(request: $request) {
    totalRecords,
    inventories {
      inventoryId,
      location,
      name,
      products {
        productId,
        code,
        quantity,
        canPurchase
      }
    }
  }
}

Get Products from Catalog

Variables

{
  "request": {
    "pageIndex":1,
    "pageSize": 100
  }
}

Query

query getProductsInCatalog($request: ProductCatalogApi_GetProductsRequest!) {
  ProductCatalogApi_GetProducts(request: $request) {
    totalOfProducts,
    products {
      productId, 
      name,
      code,
      totalAvailability,
      inventories {
        inventoryId,
        name,
        location,
        quantity,
        canPurchase
      }
    }
  }
}

Create Product in Catalog

Variable

{
  "request": {
    "productName": "New Product - 4",
    "productCode": "N-PRD-4"
  }
}

Mutation

mutation createProductInCatalog($request: ProductCatalogApi_CreateProductRequest!){
  ProductCatalogApi_CreateProduct(request:$request){
    productId,
    name,
    code
  }
}

Add Product to Inventory

Variable

{
  "request": {
    "productId": "b1bdfa34-3fa2-4314-89be-52b671039c47",
    "inventoryId": "7aa9115d-00d9-4215-98fa-cbd9aceb0744",
    "quantity": 5,
    "canPurchase": true
  }
}

Mutation

mutation addOrUpdateProductInventory($request: AddOrdUpdateProductInventoryRequestInput){
  addOrUpdateProductInventory(request: $request) {
    inventoryId,
    productId,
    code,
    inventoryName,
    quantity,
    canPurchase
  }
}