Subscriber update via API fails
I am unable to update subscribers via the PUT endpoint /api/subscribers/:id. Regardless of the actual body the endpoint always returns a 200 response with no updates performed.
Issue #237 seems to be about the same problem.
Generally is the PUT endpoint supposed to merge/override new data or does all subscriber data need to be sent again + the additional/update data?
Issue #237 unfortunately doesn't provide any context. I just responded with an example there.
Generally is the PUT endpoint supposed to merge/override
Whatever field is sent is merged into the record. You needn't send the whole payload again.
I inspected the request from the UI, I think the issue was missing id property in body. I assumed since it is in the endpoint path it doesn't need to be in the body. Once I added id to the JSON body it works fine.
Ah! That's a subtle bug. Fixed: https://github.com/knadh/listmonk/commit/f8e555dac5451d338be42966835f33355af08a2b
Issue #237 unfortunately doesn't provide any context. I just responded with an example there.
Generally is the PUT endpoint supposed to merge/override
Whatever field is sent is merged into the record. You needn't send the whole payload again.
@knadh Thanks for support and fixing this so fast! Just one follow-up on the payload. From my tests it looks like attribs will not be merged but new value overrides old, is that expected?
Fixed this behaviour as well: https://github.com/knadh/listmonk/commit/e8ad7a9adcbc7a268e0dbba6b217268bb210df46
This'll be available in the upcoming release this weekend.