Closed Bug 1074959 Opened 10 years ago Closed 10 years ago

[buddyup] Add question metadata API

Categories

(support.mozilla.org :: Questions, task, P2)

Tracking

(Not tracked)

RESOLVED FIXED
2014Q4

People

(Reporter: mythmon, Assigned: mythmon)

References

Details

(Whiteboard: u=user c=api p=2 s=2014.19)

There should be an API for manipulation question metadata. This should be bound to the same permissions as changing the question.
This should be a pretty easy, but there is new API stuff to figure out with these kind of M2M fields. I think this is 2 points at this point.
Whiteboard: u=user c=api p= s=2014.18
Whiteboard: u=user c=api p= s=2014.18 → u=user c=api p=2 s=2014.18
Priority: -- → P2
Target Milestone: --- → 2014Q4
Status: NEW → ASSIGNED
This needs to move to the next sprint. Didn't make it here.
Whiteboard: u=user c=api p=2 s=2014.18 → u=user c=api p=2 s=2014.19
I landed this in https://github.com/mozilla/kitsune/commit/b292cba9ab0622863fb973ab33c30686da3b71d9

This is on stage now. The buddyup developers are doing development on stage, so this doesn't need to go to master.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Does this bug include filtering the question list by metadata? Or do we need a new bug for that?
Oops, this bug is solved. I guess we need a bug filed for filtering by metadata because I don't see it in open bugs.
I am guessing this works the same as set_setting/delete_setting in that one needs to delete a setting before setting it to ensure no duplicates exist?

One problem with this though is that, if you try to delete a metadata entry that does not exist, it returns a 404 with the message detail "No matching metadata object found."

Thing is we cannot just set on an assumption it will not exist, I don;t think so, we will have to (as with settings), first delete, then set. In this case it means we will have to delete, if that fails with the above error, handle the error and set the metadata item.

I reckon we should look at making this an set/update operation. If it exists, overwrite. If not, create.
Flags: needinfo?(mcooper)
We could also perhaps have delete_metadata only return an error if something actually went wrong while deleting the item on the server. If the item simply did not already exist, it should probably just happily return.
The intention was not that calling set_setting twice would  create duplicates, and you shouldn't need to delete settings to change them. That is a bug I'll work on fixing. Your reckoning that this should be a set/update is spot on, and what I intended from the beginning.

I think that deletion should return 404, as there is no matching item. Clients should feel free to ignore the 404, especially since you shouldn't need to delete before setting.
Flags: needinfo?(mcooper)
You need to log in before you can comment on or make changes to this bug.