Hypermedia | Hypermedia library for .NET | DevOps library
kandi X-RAY | Hypermedia Summary
kandi X-RAY | Hypermedia Summary
A .NET Client and Server foundational Hypermedia library for .NET. Currently, there is only support for the JSON API format, but the foundation has been designed with extensibility in mind. The packages are currently available via NuGet.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Hypermedia
Hypermedia Key Features
Hypermedia Examples and Code Snippets
Community Discussions
Trending Discussions on Hypermedia
QUESTION
According to the Spring HATEOAS API,
Activates hypermedia support in the ApplicationContext. Will register infrastructure beans to support all appropriate web stacks based on selected HypermediaMappingInformation-type as well as the classpath.
My Spring Boot application (2.3.4) has the following dependencies:
...ANSWER
Answered 2021-Aug-21 at 03:16Spring Boot already auto configures for you if your dependencies contains spring-hateoas
. The dependency spring-boot-starter-data-rest
contains spring-hateoas
.
File org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration
has @EnableHypermediaSupport(type = HypermediaType.HAL)
.
QUESTION
I am reading from an external API with hypermedia links and OAuth2 authentication using Spring's WebClient. When accessing the API the JSON data is correctly converted to model objects but the supplied HAL links are either omitted if the model object extends Spring HATEOAS RepresentationModel or give a NullPointerException when the model object extends EntityModel. I suspect a problem with the hypermediaWebClientCustomizer but was not able to solve it as of now.
I tried reading the JSON with a Traverson client in a testcase. That was basically working, if i replaced relative URIs with absolute URIs and the application/json header with a application/hal+json header. I would go on with Traverson but besides these two problems Traverson requires a RestTemplate (OAuth2RestTemplate in this case), which is no longer available in our Spring version.
Any ideas if there is a problem with the configuration or what else could go wrong?
This is my configuration:
dependencies (in part)
...ANSWER
Answered 2021-Apr-01 at 12:55It seems the content-header hal+json was the missing piece, although i'm sure quite sure i tried this before. Probably something else was wrong before that has been fixed in between. At least the test case is now working with this:
QUESTION
HTTP cookies violate the REST architectural style because they are independent of application state and they have no semantics, according to Roy Fielding’s doctoral dissertation Architectural Styles and the Design of Network-Based Software Architectures, § 6.3.4.2 ‘Cookies’:
An example of where an inappropriate extension has been made to the protocol to support features that contradict the desired properties of the generic interface is the introduction of site-wide state information in the form of HTTP cookies. Cookie interaction fails to match REST's model of application state, often resulting in confusion for the typical browser application.
Cookies also violate REST because they allow data to be passed without sufficiently identifying its semantics, thus becoming a concern for both security and privacy. The combination of cookies with the Referer [sic] header field makes it possible to track a user as they browse between sites.
So he suggests the following alternative:
As a result, cookie-based applications on the Web will never be reliable. The same functionality should have been accomplished via anonymous authentication and true client-side state. A state mechanism that involves preferences can be more efficiently implemented using judicious use of context-setting URI rather than cookies, where judicious means one URI per state rather than an unbounded number of URI due to the embedding of a user-id. Likewise, the use of cookies to identify a user-specific "shopping basket" within a server-side database could be more efficiently implemented by defining the semantics of shopping items within the hypermedia data formats, allowing the user agent to select and store those items within their own client-side shopping basket, complete with a URI to be used for check-out when the client is ready to purchase.
My understanding of his user preference example is the following. Let’s say that a website allows its users to choose between a light theme (the default) and a dark theme in a preference page at URI /preferences
(like Stack Overflow). When a user chooses the dark theme, he should be redirected to the URI /preferences?theme=dark
whose HTML representation will be the same as the HTML representation of the URI /preferences
, except that it will be now in dark mode and the query ?theme=dark
will be appended to all the embedded hyperlinks. That way, if the user selects for instance the embedded hyperlink to the home page at URI /home?theme=dark
(not /home
), then the HTML representation of the home page will also be in dark mode and the query ?theme=dark
will also be appended to all its embedded hyperlinks. To revert to the light theme, then the user selects the embedded hyperlink to the preference page at URI /preferences?theme=dark
, chooses the light theme in the preference page and should be redirected to the URI /preferences
whose HTML representation will be the same as the HTML representation of the URI /preferences?theme=dark
, except that it will be now in light mode and the query ?theme=dark
will be removed from all the embedded hyperlinks. Is it what Roy Fielding meant?
Likewise for his shopping cart example, when the user adds a product i to cart, he should be redirected to a URI with a query ?product-{i}={product-i}&quantity-{i}={quantity-i}
whose HTML representation will have that query appended to all its embedded hyperlinks. That way, when the user selects the check out hyperlink /checkout?product-1={product-1}&quantity-1={quantity-1}&…&product-n={product-n}&quantity-n={quantity-n}
, the content of the shopping cart is sent to the website. Is it what Roy Fielding meant?
ANSWER
Answered 2021-May-24 at 01:07I believe you are correctly interpretting Fielding's thesis in the first case, but not the second.
Your interpretation of "preferences" seems exactly correct: it's perfectly reasonable to have multiple resources whose representations include the same information, but different presentation, like having a dark theme and a light theme as parallel resource structures.
But I believe that you misinterpret Fielding's proposal of "client-side shopping basket". He's not proposing introducing server side resources to be edited (after all, this capability already exists in the web we have today); but rather the introduction of a general purpose language for storing interesting pieces of client state on the client.
In other words, Fielding is talking about introducing within the HTML standard some controls (similar to the controls of a web form) that would allow the human to save some information would would later be loaded into a form when actually placing an order.
Imagine, if you will, a special kind of form that, when submitted, edits a resource that is local to the web browser itself. So you could pick items out of a catalog, and in doing so your local shopping cart resource would be modified. When you were ready to check out, the contents of your shopping cart would be available to sent to the server.
In the same way that forms are general purpose, and can be used for many different domains, so to we would want this shopping cart plumbing to be general purpose, so that it could be used for any sort of "copy this information to be used later" mechanism.
The trick (that didn't happen) is defining a standard and then getting everybody (browsers makers) to implement those standards in similar enough ways that everything just works.
QUESTION
I'm attempting to dynamically set properties for an HTTP response using the getL
function, but it gives me back a Promise and I cannot set async
over the forEach
, since that breaks it (see the generateLinksForList
function). Is there another way to do this?
ANSWER
Answered 2021-Mar-23 at 21:20.forEach
won't wait for an async function. Use a normal loop:
QUESTION
While my end goal is to prevent Swagger UI from losing authentication upon browser reload, I believe I might have found a solution assuming swagger-ui parameters can be changed when using api-platform, and described it at the tail of this post.
A REST API uses Symfony, API-platform and authenticates using JWT and documentation is provided by swagger-ui. On the swagger-ui page, after submitting the apiKey, future requests include it in the header, however, if the browser is refreshed, the authorization token is lost.
There has been some discussion on this topic primarily on this github post and some on this stackoverflow post, and the general consensus seems to be that swagger-ui there is no "official" way to persist tokens.
Overall Swagger UI does not store tokens, and probably on purpose. There is no switch to enable this, but looks like there are little things that can be done to remember a token via cookie, local storage, indexdb, etc and when the page is reloaded, populate the token back in.
The swagger configuration documentation, however, appears to have an Authorization parameter which will allow the authorization data to be persisted upon browser refresh.
- Parameter name: persistAuthorization
- Docker variable: PERSIST_AUTHORIZATION
- Description: Boolean=false. If set to true, it persists authorization data and it would not be lost on browser close/refresh
Assuming I correctly interpret the Swagger documentation, how can the persistAuthorization
parameter be set to true?
When modifying config/api_platform.yaml
to set persistAuthorization
, I received errors Unrecognized option "persistAuthorization" under "api_platform.swagger.api_keys.apiKey". Available options are "name", "type".
and Unrecognized option "persistAuthorization" under "api_platform.swagger". Available options are "api_keys", "versions".
ANSWER
Answered 2021-Mar-20 at 17:58You can for now use the dev
version
QUESTION
I've been checking similar issues and haven't found any answer addressing what I am observing.
The issue is that I've easily managed to get Hypermedia in HAL format in my REST API when I retrieve 1 resource, but when I hit the controller methods retrieving a list of entities, then the hypermedia is NOT the same.
Here are the ouputs:
single resource returned
"_links": { "self": { "href": "http://localhost:8080/celsvs/api/books/123567891099" }, "books": { "href": "http://localhost:8080/celsvs/api/books" } }
List of resources
"links": [ { "rel": "self", "href": "http://localhost:8080/celsvs/api/books/123567891099" }, { "rel": "books", "href": "http://localhost:8080/celsvs/api/books" } ]
I started with Spring hateoas 0.25, but as I had to uplift anyway Spring boot and I saw that the Hateoas API had changed, I am now on Spring hateoas 1.0... And even after adapting my code to the new API I am still getting the same result.
I am using the RepresentationModelAssemblerSupport class to keep my controllers clean from code to generate hateoas content. So this is how it looks like:
...
ANSWER
Answered 2020-Dec-11 at 05:07The HAL specification says that the property _embedded
is used to store an array of resource object.
Edit: To answer Alberto's question in his own answer
Still, if someone can tell me why in the previous implementation the attached links did not follow the HAL format, I would appreciate. Thanks
Spring HATEOAS customizes JSON serialization of RepresentationModel
which is the parent class of CollectionModel
.
QUESTION
I am newbie to using hypermedia rest API (on openproject).
I retrieved from HATEOAS (Hypermedia As The Engine Of Application State) with javascript and show the result to HTML but not known how.
Example for my api url:
...ANSWER
Answered 2020-Sep-28 at 15:17I already have the answer! I have used angular2 programming language with the Typescript (https://angular.io) and saw:
- Very easy to render data from the Typescript (process the logic) to HTML
- The library for work with the HATEOAS API is the "ketting" (https://github.com/badgateway/ketting/wiki/Getting-Started)
==> So, this topic was resolved!
QUESTION
I just learned to use "hypermedia rest API" on openproject
I want to use "filter" param with "_links" properties on API but not know-how
Example:
...ANSWER
Answered 2020-Jul-12 at 09:58What I understood you wanting to achieve is getting all work packages in the project "design" that have been updated last within a certain time interval and that are of the type "Box".
The filters in OpenProject do not differentiate between native properties (like updatedAt) and linked resources (like type) when it comes to the structure of the filters. The syntax is always
QUESTION
Does Biztalk natively or through plugins support fetching market data from Bloomberg Hypermedia API?
...ANSWER
Answered 2020-Jun-08 at 21:49It isn't clear what sort of API's they expose.
Data License supports multiple technologies including SPARQL, RStudio, Python and Jupyter and can output Tidy Data as CSV, JSON, Turtle or XML files.
BizTalk can certainly do CSV, JSON or XML, and can communicate with SOAP or REST API services, so if it is either of those, then yes, BizTalk can natively fetch data from those.
QUESTION
I wanted to install SQLAlchemy for Python 3 for working with databases.
I searched for the package using pip3 search SQLAlchemy
, but I didn't find SQLAlchemy as part of the results.
Why don't SQLAlchemy show up in the output below, when the package is available on PyPI?
https://pypi.org/project/SQLAlchemy/
SQLAlchemy 1.3.15
...ANSWER
Answered 2020-Apr-01 at 18:38$ pip search sqlalchemy | wc -l
100
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Hypermedia
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page