java_buzz
java_buzz

Reputation: 67

_link model - HATEOAS

I have been asked to implement HATEOAS as part of our rest API and this is how the response is defined in Swagger specs

_links: 
[
 {
rel:    
 string
The relationship to the request e.g. self which contains the resource that was requested or {object name}, a link to a resource that is related to the requested resource
action: 
[
 {
    httpVerb:   
         string
        Allowed actions for this link based on the users permissions
        Enum:
        Array[4]
           0:"GET"
           1:"POST"
           2:"PUT"
           3:"DELETE"
   }
]
    href:   
      string
      A fully qualified URL to the resource.
  }
]

rel and href make sense and I could find many examples for these two but I could not find anything for actions. Is it part of the standard? Should I really send it back?

I am using Spring hateoas library and that for sure does not support actions. Any guidance on this will be appreciable.

Thanks.

Upvotes: 0

Views: 910

Answers (1)

a better oliver
a better oliver

Reputation: 26838

What's interesting is that _links (with an underscore) is a HAL thing, so I don't expect the spec you got following any standard.

One standard I am aware of that includes actions is SIREN, but they differ from the action in your example.

Many REST APIs aren't even RESTful, not to mention HATEOAS. So the value of following a particular standard (or "standard") is debatable for now.

Upvotes: 1

Related Questions