Date : March 29 2020, 07:55 AM
This might help you ETag header is not getting written into the response because you are not using caching. This behavior is specific only to Visual Studio development server. If you deploy in IIS, you will see the ETag header in response with your handler code. Even with Visual Studio development server, if you enable caching, the ETag header will be in the response. response.Headers.CacheControl = new CacheControlHeaderValue()
{
MaxAge = TimeSpan.FromSeconds(60),
MustRevalidate = true,
Private = true
};
|
REST: forms, links and hypermedia format
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I would definitely recommend you to give it a try to the siren format for your API. As they correctly mentioned in one of the comments in has a nice browser...but that one is poorly supported (you can see it in their github repository). So you should use this one which was based on the first mentioned but it has some extras like: nice error handling & supports actions for nested entities (among others)
|
what is hypermedia , hypermedia controls, hypermedia formats
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Hypermedia = the fact that client and server are talking in terms of some a uniform representation eg: hyper links.
|
AngularJS with Hypermedia (HATEOAS): how to use hypermedia urls accross states
Date : March 29 2020, 07:55 AM
like below fixes the issue I've encountered this problem a few times before. I've detailed my preferred solution step-by-step below. The last two steps are specifically for your problem outlined in your post, but the same principle can be applied throughout your application(s). 1. Root endpoint {
"_links": {
"products": {
"href": "http://localhost:4444/api/products",
}
}
}
$stateProvider.state('main', {
resolve: {
root: function($http) {
return $http.get("http://localhost:4444/api/").then(function(resp){
return resp.data;
});
}
}
});
$stateProvider.state('products', {
parent: 'main',
url: "/products",
resolve: {
products: function($http, root) {
return $http.get(root._links.products.href).then(function(resp){
return resp.data;
});
}
}
});
$stateProvider.state('products.product', {
url: "/{productId}"
resolve: {
product: function($http, $timeout, $state, $stateParams, $q products) {
var productId = parseInt($stateParams.productId);
var product;
for (var i = 0; i < products.length; i++) {
product = products[i];
if (product.id === productId) {
return $http.get(product._links.self.href).then(function(response){
return response.data;
});
}
}
// go back to parent state if no child was found, do so in a $timeout to prevent infinite state reload
$timeout(function(){
$state.go('^', $stateParams);
});
// reject the resolve
return $q.reject('No product with id ' + productId);
}
});
|
JSON Hypermedia Api with forms and links
Tag : json , By : pacorro2000
Date : March 29 2020, 07:55 AM
|