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:
https://forum.sambapos.com/t/integrators-graphql-api-guide/14047/4
After that, once you login to the local API interface, all the mutations and queries are documented.
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
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.
Can you let me know how to add Different prices(Takeaway, Delivery) using GraphQL?
Prices are defined by product, portion, order tag(s)
Use them how you want in any context.
GQL is everything agnostic. It takes your input and puts it in the DB.
Can you give a sample?
addProduct mutiation is what you’ll use
I am using following object format to insert product
{
“name”: “ABC”,
“groupCode”: “AABB”,
“portions”: [{“name”:“Normal”,“price”:7.00}],
“tags”:[{“name”:“Online”,“value”:“online”}]
}
Would suggest what extra I can add to define Product defination price?
What is product definition price? I don’t think there is such a thing.
You define where and when the product is used. You could use price definitions and then automation when an order is added to ticket and if ticket type is delivery, use delivery price; if the ticket type is takeaway, use takeaway price.
Alternatively you could add products with different portions specifying takeaway or delivery:
{
“name”: “ABC”,
“groupCode”: “AABB”,
“portions”: [{“name”:“Normal - Takeaway”,“price”:7.00}],
“tags”:[{“name”:“Online”,“value”:“online”}]
}
{
“name”: “ABC”,
“groupCode”: “AABB”,
“portions”: [{“name”:“Normal - Delivery”,“price”:8.00}],
“tags”:[{“name”:“Online”,“value”:“online”}]
}