Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription to EventService/Subscriptions - 204 response code #53

Open
antesaj opened this issue Mar 14, 2019 · 6 comments
Open

Subscription to EventService/Subscriptions - 204 response code #53

antesaj opened this issue Mar 14, 2019 · 6 comments
Labels

Comments

@antesaj
Copy link

antesaj commented Mar 14, 2019

I'm attempting to use Node to send a POST request to /redfish/v1/EventService/Subscriptions with the following body:

        EventDestination: {
          EventFormatType: "MetricReport",
          SubscriptionType: "RedfishEvent",
          Destination: "http://localhost:8080/api/event_in"
        }
      }

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

@tomasg2012
Copy link
Contributor

tomasg2012 commented Mar 14, 2019

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...

@antesaj
Copy link
Author

antesaj commented Mar 14, 2019

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.

@tomasg2012
Copy link
Contributor

tomasg2012 commented Mar 14, 2019

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!

@antesaj
Copy link
Author

antesaj commented Mar 14, 2019

Okay - great! I wasn't sure if I'm not meeting some 'minimum requirement' for subscription POST parameters.

@mraineri
Copy link
Contributor

mraineri commented Mar 19, 2019

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.

@antesaj
Copy link
Author

antesaj commented Mar 19, 2019

Thanks for the clarification!

@mraineri mraineri added the bug label Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants