api-design

Best practice to batch update a collection in a REST Api call [closed]

旧城冷巷雨未停 提交于 2019-12-11 11:55:13
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . Hi I'm looking for best practices with API design to batch update a collection with an API call. My collection has URL /api/v1/cars and I would like to update all the cars in the collection to add a timestamp of the current time. { data: [ { manufacturer: 'Porsche', timestamp:

Platform Independent Tool for Creating API Documentation / Proposal [closed]

老子叫甜甜 提交于 2019-12-11 07:30:51
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . What tools exist for developing platform indepedent API Documentation? I'm in the process of designing a proposed API, and want to write documentation in a structured and easily editable way. A lot of the answers I've seen have basically been "Use built in language specific documentation tools", but since I'm

How to submit scores securely from app that uses only facebook login?

烂漫一生 提交于 2019-12-11 07:13:57
问题 Our android app only has facebook login . Here's what happens in server: A user is created when a POST request is sent using facebook's user access token in body. Whenever a user gets created via POST request, an api token is generated and sent as a response as follows: {"message":"User Successfully Created","api_token":"ACITyBKf0jKrfqOFumTMcaEEJ8jU151crRdESMPmBj8zbeENslULHfNXlKeo"} I did this because the api token that is generated in the server is stored in android app's local storage and

Is the number of color attachments bounded by API

我们两清 提交于 2019-12-11 06:38:21
问题 The OpenGL specification requires that a framebuffer supports at least 8 color attachments. Now, OpenGL uses compile-time constants (at least on my system), for stuff like GL_COLOR_ATTACHMENTi and GL_DEPTH_ATTACHMENT attachment follows 32 units after GL_COLOR_ATTACHMENT0 . Doesn't this mean that regardless of how beefy the hardware is, it will never be possible to use more than 32 color attachments? To clarify, this compiles perfectly with GLEW on Ubuntu 16.04: static_assert(GL_COLOR

Java API design: narrow return type in methods

两盒软妹~` 提交于 2019-12-11 06:00:25
问题 Suppose I have a type family, I have defined a set of methods in base type: interface Foo<T> { Foo<T> a(); Foo<T> b(); ... } And Bar extends Foo interface Bar<T> extends Foo<T> { Bar<T> a(); Bar<T> b(); ... } And then Zee extends Bar interface Zee<T> extends Bar<T> { Zee<T> a(); Zee<T> b(); ... } When I implement this type family with different decorators, I found I constantly write something like class XBar<T> extends XFoo<T> implements Bar<T> { Bar<T> a() { return (Bar<T>)super.a(); } Bar<T

HATEOAS and links/actions

江枫思渺然 提交于 2019-12-11 04:46:55
问题 I'm trying to wrap my head around how to (and if to) implement HATEOAS in my api. I like one of the concept of feeding the client only actions that are appropriate in the current situation. However I'm not sure if I'm implementing this idea correctly. Let's say I have a resource type order with a status that can be changed, it can have different statuses ( processing , accepted , declined , expired , successful). Should I then create the following json object: { ... "links": { "accept": "http

API returning null values for linked table IDs

你离开我真会死。 提交于 2019-12-11 04:27:58
问题 This is a problem that I have been having a lot of trouble with and would be so grateful for some help. I have created a 'NewPurchases' API that is linked to a Customer ID and Handset ID. However, when I manually populate the 'Purchases' table in the database and check the GET functionality of this API on POSTMAN, it returns null values for Customer and Handset ID: <Purchase> <CommissionGenerated>100</CommissionGenerated> <Customer i:nil="true"/> <DatePurchased>2018-02-15T00:00:00<

How to pass complex object as $http params and receive as a view model in API controller action

邮差的信 提交于 2019-12-11 04:15:32
问题 I have an API endpoint. The controller action looks like this - public IHttpActionResult Post(string entityType, SomeModel someModel) Here SomeModel is a view model, which looks like this - public class SomeModel { public long? Id { get; set; } public long EntityId { get; set; } public string Text { get; set; } } I am calling this API endpoint from angularjs end - return $http({ method: 'POST', url: ENV.apiEndpoint + 'tags', params:{ // here I want to pass parameters which will automatically

Should I return id of associated entity or whole entity

岁酱吖の 提交于 2019-12-11 01:26:10
问题 OK, lets assume we have two entities: Profile , consisting of id , name and ~10 irrelevant fields, and Post , consisting of text , title , and it's author (Profile). Also, there is resource /feed that returns feed containing posts from different profiles. So I have two options: Send full Profile entity in author Send author's id (there is a way to request Profiles separately) Which way is faster (in terms on using it on front end) and more convenient (RESTy, if you like). 回答1: Obviously just

Multipart HTTP Response vs Zip File For API Response

最后都变了- 提交于 2019-12-11 01:13:02
问题 If I want to return multiple files in one HTTP response from my API because my clients have very low bandwidth and bad internet connectivity, what is my best option for sending them to the client? Should I use a Multipart HTTP response or zip up all my files and return those? I realize that Multipart HTTP responses are not recommended for browsers but I am talking about an API where I control the client. 来源: https://stackoverflow.com/questions/38139818/multipart-http-response-vs-zip-file-for