I keep getting 500 errors when posting & putting to various end-points (not all the time, but often enough). Is there somewhere I can see Veeqo’s logs to try and better debug what the problem is, and whether it’s something I can fix?
Hey Tam,
Unfortunately we don’t expose our logs to the public. If you let me know the user ID
you’re using (check response for created_by_id
or updated_by_id
) I can help diagnose.
Normally we only see 500 errors during development.
User ID: 24640
Something something 20 characters something
ActiveRecord::UnknownAttributeErrorproducts#update
unknown attribute 'weight_unit' for ProductVariant.
try not including weight_unit
NoMethodError orders#create
undefined method `id' for nil:NilClass
Your request was missing a “customer_id”
Can you double check the customer_id
that you’re sending. If you have any other issues then let me know.
I’ve made those changes, but I’m still getting 500 errors.
It would be nice if the API responded with the errors rather than just 500ing, since your API and docs seem to be at odds with each other.
please can you send the full request you’re making?
What do you mean about the API and docs being at odds with each other. I’m always keen to hear feedback and improve our documentation.
The order (ignore the PHP array dump, I’m sending JSON):
Array
(
[order] => Array
(
[channel_id] => 49947
[customer_id] => 12843556
[delivery_method_id] => 191837
[deliver_to_attributes] => Array
(
[first_name] => Not
[last_name] => My
[address1] => Real
[address2] =>
[city] => Address
[state] => Lorem
[country] => GB
[zip] => F4K3 71P
[customer_id] => 12843556
)
[number] => eace43a65132597b0dbad098f5197145
[send_notification_email] => false
[total_discounts] => 0
[line_items_attributes] => Array
(
[0] => Array
(
[sellable_id] => 18320411
[price_per_unit] => 14.9900
[quantity] => 1
[tax_rate] => 0
[taxless_discount_per_unit] => 0
)
)
[payment_attributes] => Array
(
)
)
)
Regarding the docs:
-
unknown attribute 'weight_unit' for ProductVariant
- According to the docsweight_unit
is at the product variant level. -
customer_id
isn’t mention in the Order attributes (but is in the request example). - The Create Product attributes are all top level, when they need to be within a
product
object (again, this is in the request example, which I should probably rely on rather than the attributes).
The examples are, in general, a bit more in depth than the attributes.
I’ve tried really hard to provide varied and comprehensive examples, particularly for creating orders as this is something that normally takes a few attempts to get right.
Please can you include a payment_type
if you are sending payment_attributes
. This is actually covered in the attributes and the examples!
I’ve also added customer_id
back to the required order attributes. Not sure why it had decided to disappear, thank you for pointing that out.
I’m not sure why weight_unit
isn’t working. It has done for me in the past.
Posting orders is working now! Still getting a 500 error with products.
This is what I’m sending (I’ve removed the image URLs):
Array
(
[method] => PUT
[endPoint] => products/12562973
[body] => Array
(
[product] => Array
(
[title] => Microbe-Lift All-In-One
[product_variants_attributes] => Array
(
[0] => Array
(
[title] => 118ml
[price] => 9.9900
[sku_code] => 097121211217
[weight_grams] => 0
)
[1] => Array
(
[title] => 236ml
[price] => 14.9900
[sku_code] => 097121211224
[weight_grams] => 0
)
[2] => Array
(
[title] => 473ml
[price] => 20.9900
[sku_code] => 097121211231
[weight_grams] => 0
)
)
[images_attributes] => Array
(
[0] => Array
(
[src] => (...)
[display_position] => 1
)
[1] => Array
(
[src] => (...)
[display_position] => 2
)
[2] => Array
(
[src] => (...)
[display_position] => 3
)
)
[weight_unit] => g
)
)
)
the only thing that doesn’t look right to me in that request is the weight_unit
attribute at the end.
Please can you try a test without this?
Completely removing weight_unit
works. It always fails if I try to include it anywhere (either on the product or in a variant). I’m converting all weights to grams, and the response includes weight_unit
as g
so I guess it’s fair to assume that grams is the default?
weight_unit
doesn’t need to be included in the product. It should inherit from the channel.
That would be a safe assumption.