api-design

Api Gateway and Sharing Service Models

一笑奈何 提交于 2020-08-26 03:37:28
问题 The short version of my question is that I'm trying to wrap my head around how models are "shared" between an API Gateway and internal microservices. I assume that the gateway can be responsible for transforming calls to multiple services and returning a new aggregated representation of the data. How does the gateway know about the available models from the microservices? In my simple example. I have: API Gateway User Service Restaurant Service User Service This rest service would expose an

How can I test async callbacks in JMeter?

时间秒杀一切 提交于 2020-07-19 07:05:46
问题 I am using WebHooks in my API. So, once a request is processed our REST Service will POST a response back to the callback URL sent in the request. Client Server |(request) | |----------------->| |<-----------------| || | (response)| || | | _||_ Time | (callback)| \ / |<-----------------| \/ |----------------->| |(response) | | | How can this be stress tested with JMeter? 回答1: It depends on WebHook implementation, if it is a matter of polling - you can just use While Controller to wait for

Why unique_ptr and shared_ptr do not invalidate the pointer they are constructed from?

一曲冷凌霜 提交于 2020-03-15 05:46:42
问题 A note: this is an API design question , riding on the design of the constructors of unique_ptr and share_ptr for the sake of the question, but not aiming to propose any change to their current specifications. Though it would usually be advisable to use make_unique and make_shared , both unique_ptr and shared_ptr can be constructed from a raw pointer. Both get the pointer by value and copy it. Both allow (i.e. in the sense of: do not prevent ) a continuance usage of the original pointer

Is there standard way of making multiple API calls combined into one HTTP request?

橙三吉。 提交于 2020-02-28 12:59:39
问题 While designing rest API's I time to time have challenge to deal with batch operations (e.g. delete or update many entities at once) to reduce overhead of many tcp client connections. And in particular situation problem usually solves by adding custom api method for specific operation (e.g. POST /files/batchDelete which accepts ids at request body) which doesn't look pretty from point of view of rest api design principles but do the job. But for me general solution for the problem still

Single API endpoint pros and cons

限于喜欢 提交于 2020-02-24 12:30:05
问题 I am creating API and trying to figure out is planned approach any good. That API is not public and it will be used by SPA and mobile app that I build. So I am thinking of GraphQL-like design but without posting json and with regular HTTP methods. Something like this for GET methods: Example 1 - get users with specific fields(_join indicates sql table join), ordering and limit: api.com?table=users&displayFields=id,name,email,address,tel,country_join&orderBy=asc&orderColumn=name&offset=0&limit