Sambapos addProduct using GraphQL

Can anyone help by sharing the query of addProduct using GraphQL? Also let me know how to add options with the product via API.

Hiya and welcome!

This post will get you setup on how to connect to the API:

After that, once you login to the local API interface, all the mutations and queries are documented.

2020-10-08_09;49_1602172199_chrome

Thank you. It helped me. No here I’m getting another issue during creating a Ticket
mutation m{addTicket(
ticket:{type:“Delivery Ticket”,
department:“Delivery”,
user:“Administrator”,
terminal:“Server”,

            entities:[{entityType:"Customers",name:"9875566735"}],
            states:[
                {stateName:"Status",state:"Unpaid"},
                {stateName:"Source",state:"Go4Food"},
                {stateName:"Delivery",state:"Waiting"}
            ],
            tags:[{tagName:"Delivery Minutes",tag:"26681224"}],
            calculations:[],
            orders:[{
        name:"Fountain Drink",
        menuItemName:"",
        quantity:1,
        price:12.00,
        tags:[],
        states:[
            {stateName:"Status",state:"New"}
        ]
    }]
        }){id}}

Getting this message
Error trying to resolve addTicket.
Sequence contains more than one element
Can you please help?
Also how do I add extra options(addons/toppings) with an item except the size?

I believe addTicket is deprecated as it didn’t execute any automation.

You’ll want to use createTerminalTicket and updateTerminalTicket to set things like ticket tags and states

from there you’ll use addOrderToTerminalTicket to add orders, and updateOrder to set order tags

This functionalitty is very important requirement to us
Please reply

Should I need to follow createTerminalTicket if I going to develop something like gloriafood? Please suggest

Just so you are aware, there is already an official integration for Gloriafood. Is that what you were planning to develop?

Actually we have a similar software and our clients want to sync the orders with sambapos like gloriafood. So we are going to develop an nodebased aplication do achive the same thing.

That’s one of a few that you’ll have to use.

The flow would be something like this:

  • Get Access Token
  • Register Terminal
  • Create Ticket
  • Update Ticket
  • Entity Check
  • Create Entity if not exists
  • Change Ticket Entity
  • Add Order
  • Update Order
  • Add Calculations
  • Add Payments
  • Close Ticket
  • Unregister Terminal
1 Like

Can you please help me why the following is not running
mutation m {
updateProductPrice(
name: “Meat Lovers Pizza”,
portion: “Normal”,
price: “11.99”,
priceTag:"",
notifyClients: true
)
{id}
}
I’m getting the below response
{
“data”: {
“updateProductPrice”: null
},
“errors”: [
{
“locations”: [
{
“line”: 0,
“column”: 0
}
],
“message”: “Error trying to resolve updateProductPrice.”,
“data”: {},
“innerException”: {
“ClassName”: “System.NullReferenceException”,
“Message”: “Object reference not set to an instance of an object.”,
“Data”: null,
“InnerException”: null,
“HelpURL”: null,
“StackTraceString”: " at GraphQL.ObjectExtensions.GetPropertyValue[T](Object value)\r\n at GraphQL.Types.ResolveFieldContext.Argument[TType](String name)\r\n at Samba.Services.Graphql.Menus.MenuMutation.UpdateProductPrice(ResolveFieldContext arg) in C:\Users\Vehbi\Documents\Source\Repos\sambapos-v5-pro\Samba.Services\Graphql\Menus\MenuMutation.cs:line 155\r\n at GraphQL.DocumentExecuter.d__8.MoveNext()",
“RemoteStackTraceString”: null,
“RemoteStackIndex”: 0,
“ExceptionMethod”: “8\nGetPropertyValue\nGraphQL, Version=0.11.0.493, Culture=neutral, PublicKeyToken=null\nGraphQL.ObjectExtensions\nT GetPropertyValueT”,
“HResult”: -2147467261,
“Source”: “GraphQL”,
“WatsonBuckets”: null
},
“stackTrace”: null,
“helpLink”: null,
“source”: null,
“hResult”: -2146233088
}
]
}

Try to remove quotes from price, is the product already added?

Yes, product added going to update the price

The double quotation marks after name and portion aren’t valid, but the ones you use after priceTag are fine.
And as Francisco pointed out, price should NOT be a string.