s22_tech Moderator Fra United States Medlem siden okt. 2019 s22_tech jan. 10 2024 07:33 p.m. Using the api, when updating an order, can a comment be added also? If so, how would that get passed via the api, since they are stored in a different table than the orders?
tim Founder Fra Sweden Medlem siden mai 2013 tim jan. 11 2024 10:56 a.m. Comments is it's own table of data and I think you will need to add it as a separate endpoint e.g. /api.php/orders/123/comments/. See how product images is done in the API.
s22_tech Moderator Fra United States Medlem siden okt. 2019 s22_tech jan. 11 2024 04:25 p.m. Product images is not in the api. Were you thinking of another table? Also, would I need to create an ent_comments file to handle them? Or will save() in ent_orders be enough?
dodo Moderator Fra Lithuania Medlem siden mar. 2016 dodo jan. 12 2024 12:39 p.m. tim, am I wrong to say that API addon can handle everything that's inside entities?
tim Founder Fra Sweden Medlem siden mai 2013 tim jan. 12 2024 01:34 p.m. @dodo, you are mostly right. It can handle everything that is processed by $entity->save(). But appending comments would be hard as you would need to re-add those that are current to prevent them from getting removed. When we set $order->data['comments'] we kind of replace everything that exists in it currently. Therefore a special endpoint would be convenient. [quote]Product images is not in the api. Were you thinking of another table?[/quote] Is it not in the last version available?
s22_tech Moderator Fra United States Medlem siden okt. 2019 s22_tech jan. 12 2024 03:42 p.m. [quote]Is it not in the last version available?[/quote] Yep. You snuck one past me. 🙂