Open antesaj opened 5 years ago
While a 201 is more appropriate of a response based on the specification, my interpretation of the spec reads that a 204 may be returned while still succeeding with a POST/PATCH in a few places (it just reads "if the service is unable to return a payload", rather than "service was unable to create/patch a payload", the former being a 2 code and the latter being some 4 code)
But yes, 201 should be returned in most of these cases if possible, I'm just not sure if it's 100% reliable when writing a client for it. Will likely still implement 201 but I would want to ask...
Is my POST body format correct for a successful subscription?
Also, from https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.6.1.pdf :
On success, the Event Service shall return an HTTP status 201 (CREATED) and the Location header in the response shall contain a URI giving the location of the newly created subscription resource.
In terms of the payload, you shouldn't be wrapping the content inside of "EventDestination :", it should just start with the curly braces. I believe some mock-ups have a mock subscription listed (like public-bladed?)
Thanks for the spec catch!
Okay - great! I wasn't sure if I'm not meeting some 'minimum requirement' for subscription POST parameters.
Just for clarity, this is what the body of the POST request should look like:
{
"EventFormatType": "MetricReport",
"EventTypes": [ "MetricReport" ],
"Destination": "http://localhost:8080/api/event_in"
}
"SubscriptionType" is not needed since this is filled in by the service once the Event Destination resource is created. "EventTypes" is also a required property on Create operations.
Thanks for the clarification!
I'm attempting to use Node to send a POST request to
/redfish/v1/EventService/Subscriptions
with the following body:I'm assuming something is wrong with my body format but I pulled this from the EventDestination schema. I'm getting a 204 response from RMS and am expecting a 201.
For the full function, see line 272-290 at https://github.com/andrewbossie/SER401-Redfish/blob/US-51-aantes/rfInsight/controllers/RoutesController.js