Hi
I’m making a batch-upsert
request to insert a pricing rule but am getting the following error:
{
category: 'INVALID_REQUEST_ERROR',
code: 'MISSING_REQUIRED_PARAMETER',
detail: 'Missing required parameter.',
field: "'discount_id' should be set."
}
My content is
{
"id": "#PricingRule",
"type": "PRICING_RULE",
"is_deleted": false,
"present_at_all_locations": true,
"pricing_rule_data": {
"discount_id": "GTUHSTXJJ5OE5IKUKTLRJ2KE",
"match_products_id": "TTS46H54T5A4XJ7LLQ5CWLU6"
}
}
I can confirm both the discount_id
and match_product_id
refer to existing discount and product sets.
I’m running on the sandbox environment. The corresponding discount and product sets created fine in a separate batch. I also tried creating all three together in the same batch using the #
ID from the discount and product set but got the same result.
I was first getting this error through the Node SDK but can replicate on the API explorer (I’ll post the full curl below
curl https://connect.squareupsandbox.com/v2/catalog/batch-upsert \
-X POST \
-H 'Square-Version: 2022-01-20' \
-H 'Authorization: Bearer xxx \
-H 'Content-Type: application/json' \
-d '{
"batches": [
{
"objects": [
{
"id": "#PricingRule",
"type": "PRICING_RULE",
"is_deleted": false,
"present_at_all_locations": true,
"pricing_rule_data": {
"discount_id": "GTUHSTXJJ5OE5IKUKTLRJ2KE",
"match_products_id": "TTS46H54T5A4XJ7LLQ5CWLU6"
}
}
]
}
],
"idempotency_key": "a36bb3c2-ea96-4d68-93b2-240ad30dc336"
}'
Any help gratefully appreciated.
Thank you