restful-architecture

Good practices to propagate errors through micro services

孤街浪徒 提交于 2019-12-10 13:18:52
问题 We have a micro services architecture and we are having some discussions about how to expose internal errors to the client. Here's an example: Let's suppose we have 3 services, service A, B and C. When the client sends a request to the service A, which is public, this service sends a request to service B that sends a request to service C (which are internal and needs authentication, but the credentials are stored internally like environment variables, they are not send by the client). And for

Should the PATCH method return all fields of the resource in the response body?

泪湿孤枕 提交于 2019-12-09 04:44:43
问题 Should the PATCH method return all fields of the resource in the response body? Or should it return only updated fields? I'm reading this For example, if it returns only updated fields, the user could know which fields were updated in the server, while the user updated some fields. **Users resource representations** name: string age: number createdon: date modifiedon: date PATCH /users/{userId} Request body { name: 'changedname', } Response body Case1 { name: 'changedname', age: 20, createdon

RESTful way of getting a resource, but creating it if it doesn't exist yet

瘦欲@ 提交于 2019-12-09 03:42:52
问题 For a RESTful API that I'm creating, I need to have some functionality that get's a resource, but if it doesn't exist, creates it and then returns it. I don't think this should be the default behaviour of a GET request. I could enable this functionality on a certain parameter I give to the GET request, but it seems a little bit dirty. The main point is that I want to do only one request for this, as these requests are gonna be done from mobile devices that potentially have a slow internet

How to pass additional data to restful API Basic authentication

爷,独闯天下 提交于 2019-12-08 13:33:03
问题 I am developing my first restful API for a project. I understand and have gotten the basic authentication to work properly, using the format Basic username:password where username:password is Base64 encoded. Currently, we pass a user's email address in the 'username' field and their password in the 'password' field. The problem is that the email address is not unique in the application. It is unique per Organisation within the application. So in order to log the user in successfully, we need

SVC Web service consuming from code behind but not from javascript

只愿长相守 提交于 2019-12-08 13:28:51
问题 I want to call web service in project (but in same solution) from myClient project. I have added service reference in myClient project. When I call scf from code behind it, works but when I try to call it from JavaScript using JSON, I am unable to do so. Guys pls help. "http://someurl.com/MyWebService.svc/DoWork/" is path of my Service abovive url someurl is url of localhost This code is from a.aspx of client application of JSON, $.ajax( { type: 'GET', url: 'http://someurl.com/MyWebService

AngularJS RESTful Web Service - Delete row from table

♀尐吖头ヾ 提交于 2019-12-08 06:42:31
问题 I need to delete a row from my table but I don't want to reload or refresh all my table in order to see the updated rows. var demoApp = angular.module("demoApp", ["ngResource"]); // Controller demoApp.controller("categoryController", function($scope, deleteCategorieService, categoriesService){ $scope.categories = categoriesService.query(); $scope.deleteCategory = function(id){ deleteCategoryService.deleteCategory({id: id}); // I want to avoid this method to refresh my table. // $scope

A restful service API designing issue

旧巷老猫 提交于 2019-12-08 05:47:10
问题 One issue about the restful service API designing. I'm not sure how is a proper way to do it. Please give me some suggestions. My scenario is like this. I have a user resource and permission resource. http://www.sample.com/rest/users http://www.sample.com/rest/permissions User can have multiple permission; one permission can be used for many users; it is many to many relationship. Normally, we can say a permission belongs to a user, so we have an API like: http://www.sample.com/rest/users/

How to execute efficient communication for multiple (micro)services?

对着背影说爱祢 提交于 2019-12-08 04:02:13
问题 Case: Software build with many microservices and internal services. The doubt is how to manage performance issues (network latency, size of resource) getting multiple resources from many microservices at once. I Just can not imagine making 20 HTTP requests to access all necessary resources. 回答1: In order to reduce the number of requests made you might create a facade that encapsulates incoming API calls. This enables you to get rid of expensive network roundtrips. Netflix blogged about a very

Sending data from a browser to a server and back

一世执手 提交于 2019-12-07 16:29:21
问题 I am C++ developer and I haven't really followed up on any development related to the web for a very long time. I have this project I would like to implement, really as a goal to sort of catch up on these technologies. My project is this: display some content in a browser (for example the content of a 3D scene using a canvas and WebGL), have a button on the page. When the button is clicked, send the data to the server (the camera position for instance), render the image on the server (using

AngularJS RESTful Web Service - Delete row from table

你说的曾经没有我的故事 提交于 2019-12-07 07:52:29
I need to delete a row from my table but I don't want to reload or refresh all my table in order to see the updated rows. var demoApp = angular.module("demoApp", ["ngResource"]); // Controller demoApp.controller("categoryController", function($scope, deleteCategorieService, categoriesService){ $scope.categories = categoriesService.query(); $scope.deleteCategory = function(id){ deleteCategoryService.deleteCategory({id: id}); // I want to avoid this method to refresh my table. // $scope.categories = categoriesService.query(); }; }); // Factories demoApp.factory("deleteCategorieService", function