API Design Process Flashcards

1
Q

What can be said about consumers of API, are they machine to machine or people on other side?

A

In the API space, we build something on a machine for a machine to use and this is wrong because there are people on the other side of API clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define UX honeycomb which has 7 adjectives.

A

APIs should be
1) Useful
Is the API useful from end user’s point of view?

2) Usable
Can the API be quickly used by a developer and provide easy-to-use functionality?

3) Desirable
Is the functionality provided by the API something that generates desire in developers and end users?

4) Findable
Can the API documentation be found easily, and can developers tart using it immediately?

5) Acessible
Can the API provide functionality for end users who have technical constraints/limitations in consuming it?

6) Credible
Is the data provided by the API trustworthy?

7) Valuable
Does the API contribute to the company’s bottom line and improve customer satisfaction?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What do we mean by
Designing the right thing?
Designing the thing right?

A

1) Designing the right thing?

This phase is split into Discover/Research and Define/Synthesis. While designing something new it is very easy for people to blow the actual scope of the problem and put all their effort into designing something that no one actually wants or will use. This phase of designing keeps us grounded and makes sure we are designing for the right thing by doing diligent research and defining the right problem statement to solve.

1.1) Discover/Research

  • Gain domain knowledge.
  • Understand what problem we are trying to solve
  • Who are stakeholders
  • Use-cases and the requirements
  • Existing solutions and approaches
  • Talk to all stakeholders
  1. 2) Define/Synthesis
    - Give structure to raw data gathered from previous step
    - Try finding trends that span across multiple use-cases
    - Find dependencies to other services, like other microservice
    - Identify all the Resources for which we need APIs
    - Outline behavior and expectations of APIs
    - Identify amount of business logic that will be in service or client

2) Designing the thing right

  1. 1) Develop/Ideation
    - From previous step we are clear what needs to be done
    - OpenAPI/Swagger are great to describe important aspects of API
    - Especially the frontend design decisions and architectural decisions can be captured using API description languages as they are visible to user
    - Import swagger, OpenAPI or RAML specification files into Postman Collection
    - API documentation, Different API scenarios/states, Prototype using tools like Postman
  2. 2) Deliver/Implementation
    - Establish contract tests first so that if anything changes they start failing
    - If its a bug or legitimate change, you can update the code or inform the affected teams.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do we mean by
Designing the right thing?
Designing the thing right?

A

1) Designing the right thing?

This phase is split into Discover/Research and Define/Synthesis. While designing something new it is very easy for people to blow the actual scope of the problem and put all their effort into designing something that no one actually wants or will use. This phase of designing keeps us grounded and makes sure we are designing for the right thing by doing diligent research and defining the right problem statement to solve.

1.1) Discover/Research

  • Gain domain knowledge.
  • Understand what problem we are trying to solve
  • Who are stakeholders
  • Use-cases and the requirements
  • Existing solutions and approaches
  • Talk to all stakeholders
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why is there need to build Design Style Guide for APIs?

A

When team grows new people joining start applying their own conventions when naming endpoints, use of headers, query parameters, response structures etc. In such scenario how to ensure quality and consistency.
Even UI design teams face such challenges and they solve this by creating design style guide which make sure that everyone in the team uses the same UI component etc.
Companies like Google, Paypal have design style guides.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which is best way to learn API designing?

A

1) Create a lot of APIs
2) Read existing APIs and design practices resources

https: //www.getpostman.com/api-network/
https: //community.apigee.com/spaces/123/index.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the job of API?

A

The API’s job is to make application developer as successful as possible.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What should be the primary design principle when designing API?

A

It should be to maximize application developer productivity and success.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which are API design elements?

A

1) The representations of your resources
definition of fields in the resources (assuming structured data as opposed to stream of bytes or chars) and links to related reources

2) The use of standard HTTP headers (occasionally custom headers)

3) The URLs and URI templates
that define the query interface of your API for locating resources based on their data.

4) Required behaviors by clients for example DNS caching behaviors, retry behaviors, tolerance of fields that were not previously present in resources and so on.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What can be said about REST and state of resource?

A

In REST model, a web resource has underlying state, which cannot be seen directly , and what flows between clients and servers is a representation of that state. Users can view representation of a resource in different formats, called media types. In principle, all media types for the representation of a particular resource should encode the same information just in different formats.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which is the de-facto standard for representing resource in Web APIs and why?

A

JSON is de-facto. It is because it is easy to understand and easy to map to the programming data structures of Javascript and other languages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Limitations of JSON

A

It cannot represent many data types. Null, Boolean, String, Number. Dates and times are not supported.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What guidance should be followed to keep JSON simple

A

Names/keys in the JSON are always property names and the JSON objects always correspond to entities in your API’s data model.

Example that follows this advice:
{
  "kind": "Dog",
  "name": "Lassie",
  "furColor": "brown"
}
Example that does not follow this advice
{
  "user-id-1": {
    "data" : [
       { 
          "id": "12345",
          "picture": "url"
       } 
     ]
  }
}

This one is hard to learn. data field is artifact of JSON design and not a property on User resource.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which is the construct used in HTTP to represent relationships?

A

Link is the natural construct in HTTP to represent relationships.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why is HATEOAS (Hypermedia As The Engine Of Application State) viewed as impractical?

A

Because generic clients are usually less satisfactory, especially clients with a User interface, so such API is rarely built.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How HATEOAS helps API?

A

the realization that the use of links brings a significant
improvement to the usability and learnability of all APIs, not just those that are designed to be consumed
by completely general-purpose clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Example of JSON with relationship links

A
{
  "id": "098123",
  "kind": "dog",
  "name": "Lassie",
  "furColor": "Brown",
  "ownerLink": "https://dogtracker.com/persons/12093"
}
{
  "id": "123",
  "name": "Joe",
  "hairColor": "Brown",
  "kind": "Person",
  "dogLink": "https://dogtracker.com/persons/1234/dogs"
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

URI templates or Path params use?

A

URI templates are most useful if they accept variables whose values are easy for humans to read and remember. For example
https://dogtracker.com/persons/{personId}
is not good because it is hard to remember the obscure and length identifier.

But compared to above one
http://dogtracker.com/persons/{personName}
is more useful because names are fundamental way in which humans deal with world.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In the dog tracking example we included link to owner using ownerId property which worked well. Now what to do if the owner can be an individual or an institution?

A

We have a few options,
First we could have ownerID and supplement it with ownerType property.
Or we can have separate personOwnerID or institutionalOwnerId out of which any one will be set at a time.
We could also have a compound owner value that can incorporate the type and the id.

Most elegant and flexible solution to this is having owner property of type url.
{
…,
“owner” : “https://dogtracker.com/persons/123213”
}
or
{
…,
“owner” : “https://dogtracker.com/institutions/1122
}
So owner property is now read-write rather than read-only. We can accommodate both individual and institution by changing the URL. Clients have to be aware that the owner URL may point to different sorts of resources and they have to be prepared to react differently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Should we store URLs with domain name and scheme in database?

A

No we should not store absolute url which contains domain name in database, because if domain name changes in some circumstances then DB will have to be updated. Also we want freedom to use same database in different environments (integration test, system test, pre-production) with different domain names. This means we will have to strip the scheme and authority from URLs before storing in DB and add back when requested.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is one of solution to avoid problems storing URLs in database?

A

To use path absolute URLs that start with /. So the URLs will be relative paths. The only tradeoff is that it introduces burden on client to turn those relative URLs into absolute before using them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Give some example of URI Templates that we can send in response so that client can process it

A

{
“following_url”: “https://api.github.com/users/octocat/following{/other_user}”,
“gists_url”: “https://api.github.com/users/octocat/gists{/gist_id}”,
“starred_url”: “https://api.github.com/users/octocat/starred{/owner}{/repo}”,
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Give some example of URI Templates that we can send in response so that client can process it

A

{
“following_url”: “https://api.github.com/users/octocat/following{/other_user}”,
“gists_url”: “https://api.github.com/users/octocat/gists{/gist_id}”,
“starred_url”: “https://api.github.com/users/octocat/starred{/owner}{/repo}”,
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Explain Permalinks

A

Any link that a server puts in the representation of a resource can be bookmarked, stored by the client,
and used later. This means that you need to try to make it stable.
There is some good advice on the web on how to design stable URLs.
“After the creation date, putting any information
in the name is asking for trouble one way or another.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

In Permalinks we cannot include anything except the creation date, as anything can change. So what option do we have?

A

A consequence of following advice of not using anything other than creationdate in name is that URLs used in linking tend to be rather unfriendly to
humans. Because they must avoid including information that may change, they tend instead to have long
strings of random characters in them, like this one from Google:
https://docs.google.com/document/d/1YADQAXN2sqyC2OAkblp75GUccnAScVSVI7GZk5M-TRo

https://dogtracker.com/dogs/{uuid}

26
Q

In Permalink how to route request to implementation unit that can handle that particular type?

A

So to cater to that we cannot just include id of resource but we also need to encode the identity of the implementation unit that can handle it. As implementation units change over time, we need is some identifier that can be flexibly mapped to processing units later. So we can include “principal type” which is assumed to be immutable.

https://dogtracker.com/{type}/{uuid}

27
Q

What is the downside of encoding hierarchy in link URLs?

A

If we encode hierarchy in URL, then it will be bad. Because clients can bookmark the URLs. Hierarchies are not as stable as they seem and encoding them in URL will either prevent you from reorganizing your hierarchies or cause your persistent link to break when you do.

28
Q

What is the solution to renaming dilemma? Suppose you decide to use name in URL to keep it human friendly rather than UUID. What to do when name of the person changes?

A

The solution to this problem is to keep one URL in links and offer a different one in URI templates for queries.
For example take narendra.pathai (needs to be unique) and e9cdcf7a-25b3-11e5-9aec-34363bd0ac10. Obviously using unique name is much human friendly than UUID.

So in URI template we can have
https://dogtracker.com/person/{name}
So we get following URL
https://dogtracker.com/narendra.pathai

This URL is very attractive way to reach and find Narendra but you don’t want to use this URL in linking because while names are unique but they are subject to change, which is not desirable for persistent links.

29
Q

In the solution of renaming resources we kept two different URLs
https://dogtracker.com/persons/narendra.pathai
and
https://dogtracker.com/persons/
do they always point to the same resource

A

No. Currently when the URL is created and a unique name is chosen it may be pointing to one person. But name is subject to change and the person can rename and choose different name.
So it is like
https://wikipedia.org/page/NarendraModi (will never change)
&
https://wikipedia.org/page/CurrentPrimeMinisterOfIndia (will change)

Though they both currently point to the same resource currently but they can change.
The URL with UUID is a permanent link and will never change.

30
Q

In the solution of renaming resources we kept two different URLs
https://dogtracker.com/persons/narendra.pathai
and
https://dogtracker.com/persons/
do they always point to the same resource

A

No. Currently when the URL is created and a unique name is chosen it may be pointing to one person. But name is subject to change and the person can rename and choose different name.
So it is like
https://wikipedia.org/page/NarendraModi (will never change)
&
https://wikipedia.org/page/CurrentPrimeMinisterOfIndia (will change)

Though they both currently point to the same resource currently but they can change.
The URL with UUID is a permanent link and will never change.

31
Q

What is the disadvantage of alias approach to renaming of links?

A

In the alias approach the old links forever keep pointing to the resource and can never be freed. This is followed by GitHub. It allows renaming of repositories and uses redirects. The consequence is that the old names are never released for reuse - the URLs corresponding to the old names continue to be associated with the resource forever. This is not an issues but we need to hold on to all the previous names of resource as well as current one.

32
Q

What can be said about stability of types when we used in url
https://dogtracker.com/person/

A

In this URL there is an assumption that person is a stable property. In this case its OK, because person does not turn into a mouse or dog, but hunters turn into prey, politicians turn into lobbyists, clients are also servers and so on.
In client and server example, single resource can have multiple types.

The only motivation for having person appear in a permanent link URL is for the server to be able to route incoming requests to the right implementation. So when designing we need to think in terms of mapping current and future - between resources and implementation handlers and not in terms of meaning to clients, for whom a link URL should be opaque.

33
Q

URI template style query endpoints vs query param based.
https://dogtracker.com/persons/{personId}/dogs
vs
https://dogtracker.com/search?type=Dog&owner={personId}

A

There are number of reasons why former is preferred

  • Easier to consume and understand API, readable and intuitive
  • Implementing API is usually easier
  • In the second style people may think that all combinations of query parameters and values are supported, which can be very difficult to handle.
  • Expresses relations and graph traversals easily that are difficult to express in query parameter style.

Ex. https://dogtracker.com/dogs/123456/owner/spouse

This query url encodes the graph traversal and makes the relationship clear. These are quiet easy to express in URL as sequence of path segments, but more difficult to express in query parameters.

34
Q

What is the general pattern for query URLs when it comes to relationships between objects

A

/{relationship-name}[/{resource-id}]/…/{relationship-name}[/{resource-id}]
Where the resource-id are required only if the relationship in the preceding path segment is multi-values or one to many.

35
Q

What is the general pattern for query URLs when it comes to relationships between objects

A

/{relationship-name}[/{resource-id}]/…/{relationship-name}[/{resource-id}]

36
Q

Describe path parameters or matrix parameters

A

This is alternative syntax for query URL. Rather than using / like persons/123/dogs we can use URLs like this

/persons;123/dogs
/persons;id=123/dogs
/persons;name=narendra.pathai/dogs

which generalizes to this rule
/{relationship-name}[;{selector}]/…/{relationship-name}[{;selector}]

The elements after ; are path parameters or matrix parameters. This is a good style for its syntactic tidiness and its conceptual clarity.

37
Q

Differentiate between path segments and path variables

A

Path segments are that follow after /
and path variables are that follow ;

So representing query URL like this
https://dogtracker.com/person/123/dogs/543
is using path segments and a URL like this
https://dogtracker.com/person;123/dogs;id=543
is using path parameters.

38
Q

URL format for relationships that involve one-multiple values and filtering that collection

A

For that query parameters are a good way something like

Filter out only red dogs of person with id 123

https: //dogtracker.com/persons/123/dogs?color=red
https: //dogtracker.com/persons/123/dogs?color=brown&breed=labrador

39
Q

What to do when the responses that don’t involve persistent resources? Like calculate, translate, convert.
Here we are just making simple algorithmic calculation like how much tax someone should pay or do a natural language translation or convert one currency to other. None of these involve persistent resources returned from a database.
How to follow our noun-based model?

A

The key insight here is that the URL should identify the resource in the response, not the processing algorithm that calculates the response. Since the resource whose representation is in the response is a thing, it is easy to invent a URL for it that fits the noun-based entity model for the web. From the client’s perspective, it is irrelevant whether the result is being calculated or retrieved from the database and indeed it is common for calculated resources to be subsequently stored in persistent cache for performance.
So API for money conversion can be
/monetary-amount?quantity=100&unit=EUR&in=CNY
or simply
/monetary-amount/100/EUR/CNY

Other approach can be to POST to some noun-based URL
POST /money-converter
{
  "amount" : 100,
  "inCurrency": "EUR",
  "toCurrency": "CNY"
}
40
Q

What are problems with POST to noun-based URL approach for handling non-persistent resources like money converter, translator etc.

A

The problem with having a POST URL
/money-converter and put JSON in body to represent amount, from, to values is that
- It is not cacheable using standard HTTP mechanisms
- Beginning to stray from the uniform
interface model, because each entity you POST to typically has its own unique inputs and outputs
that are not deducible from a broader data model that underpins a whole set of operations.
- begin to look more like the wider, more complex
- we are beginning to lose one of the
most fundamental advantages of REST. Extending the DBMS analogy, this is similar to what happens
when you introduce stored procedures into a database schema—it can be powerful, but it makes the
interface more complex and increases the coupling between client and server.

41
Q

Is there a reason why urls have to have verbs in case when representing non persistent resources like money convert, translate, calculate etc?

A

No, there is no reason for a URL to appear to identify a verb - they can always be nouns that identify things or atleast identify the things that will be returned in response.

42
Q

Why should we include self-references and kind properties in response?

A

“kind” property sometimes also spelled as “isA” or “type”.
“selfLink” property sometimes also spelled as “self”, which is better choice because “self” is standardized in ATOM specification, registered in IANA and copied by others.
These properties apply to every JSON object not just to top level one.

Why self link?
This is useful because including self link makes it explicit what web resource’s properties we are talking about without requiring contextual knowledge - like what URL did we GET to retrieve this JSON. This is especially useful for nested JSON objects where the outer context doesn’t help establish what resource we’re talking about.

Why kind property?
Helps client recognize whether or not this is an object they know how to process. This helps you add new concepts to your API without having to change the API version.

43
Q

Which are the ways to represent collections?

A

Because they are collections it doesn’t mean they are any different than previous objects. So same conventions can be applied to collections as well.
For example
{“self” : “https://dogtracker.com/dogs,
“kind”: “Collection”,
“contents”: [
{“self” : “https://dogtracker.com/dogs/12343”,
“kind”: “Dog”,
“name”: “Fido”
..
},
.
]
}
The value in contents property is a JSON array of JSON objects.
The array of URLs would be another good option if your clients don’t need any data about each of the content resources.

We can also omit the collection part and just start directly with JSON array in response rather than introducing collection type.

44
Q

What are advantages of explicitly using “collection” kind over directly using JSON array.

A
  • Collections are like every other resource, not a special case.
  • The collection is self describing, don’t have to be in code to know what collection you’re looking at
  • Obvious place to put other properties like creationDate, owner, modificationdate, revisionID, parentResource etc.
45
Q

How to handle paginated collections?

A
Calling https://dogtracker.com/dogs is likely to be huge. It is neither good for client or server to return large collections. So pagination is required. This is how it has been handled in past
Req:
GET /dogs HTTP/1.1
Host: dogtracker.com
Accept: application/json

Res:
HTTP/1.1 303 See Other
Location: https://dogtracker.com/dogs?limit=25,offset=0

Req:
GET /dogs?limit=25,offset=0 HTTP/1.1
Host: dogtracker.com
Accept: application/json

Res:
HTTP/1.1 200 OK
Content-type: application/json
Content-Location: https://dogtracker.com/dogs?limit=25,offset=0
Content-length: 11233
{“self”: “https://dogtracker.com/dogs?limit=25,offset=0”,
“kind”: “Page”,
“pageOf”: “https://dogtracker.com/dogs”,
“next”: “https://dogtracker.com/dogs?limit=25,offset=25”,
“contents”: [
	 {“self”: “https://dogtracker.com/dogs/12344”,
	 “kind”: “Dog”,
	 “name”: “Fido”,
	 “furColor”: “white”
	},
	 {“self”: “https://dogtracker.com/dogs/12345”,
	 “kind”: “Dog”,
	 “name”: “Rover”,
	 “furColor”: “brown”
	},

… (23 more)
]
}

46
Q

Which are good properties to have when returning paginated response

A

pageOf - tells the original URL for which page is being sent
next - references the subsequent page (unless there is no next page)
previous - references the previous page (unless it is the first page and there is no previous)

47
Q

Is there a standard for the representation of pages of collections?

A

here is no standard for the representation of pages of collections shown here—we offer it in the spirit of
a minimalist approach that uses JSON in a simple, direct way. There are many other approaches out there.

48
Q

What approach should be taken to support multiple formats

A
  • Only JSON on output has the advantage of simplicity
  • client demand for XML or other formats
  • support multiple output formats by supporting the
    standard HTTP Accept header
49
Q

Should HTTP PATCH method be supported for update and why?

A

Yes.
- it helps with the evolution of your API.
- PUT requires client to replace the entire content of the resource with every update.
- As your API evolves, want
to be able to add new properties without breaking existing clients.
- If clients replace the entire content on
every update, you are relying on them to preserve all properties, even if they weren’t changed
and even if they didn’t exist at the time the client was written.
- This is fragile—a single misbehaved client
can cause significant problems. PATCH avoids this risk.

50
Q

Which convention should be used for property names?
camelCase
snake_case

A

It depends on customer opinion. By default camelCase works the best.
Avoid use of special characters like \/=:;,.?#<>@

51
Q

Should REST APIs look like normalized relational database schema?

A

No, no rule says that REST interfaces must look like this. That makes REST APIs “chatty”. Client will have to perform many GETs to retrieve all information.

52
Q

Solution to relational schema normalization and REST interfaces being “chatty”?

A

Normalized schemas make updates simple, so one useful strategy for an API is to define all the resources
that you would associate with a normalized schema, and give those resources both read and update
capabilities. You can then add as many read-only denormalized resources as you need to support efficient
clients. These denormalized resources are true REST resources also—they have meaning as entities, they
have URIs, and so on. Their state may overlap with the state of other resources, but this is not a problem,
and this API will be no less RESTful and much more useful than a normalized one

53
Q

Why are partial responses useful?

A

Because there may be a lot of information that the client does not need. So to allow client to tell the fields it needs we use partial response.

54
Q

Possible formats for partial response?

A

LinkedIn
/people:(id,first-name,last-name,industry)

Facebook
/joe.smith/friends?fields=id,name,picture

Google
?fields=title,media:group(media:thumbnail)

They each have an optional parameter called fields after which you put the names of fields you want to be
returned.
As you see in this example, you can also put subobjects in responses to pull in other information from
additional resources.

55
Q

Recommended approach for partial response

A

Add optional “fields” in comma separated list

/dogs?fields=name,color,location

This works well because

  • simple to read
  • application developer can select just the information an apps needs at a given time
  • it cuts down on bandwidth issues, which is important for mobile apps
56
Q

What is the advantage of including links like “first”, “next”, “previous”, “last” in REST api response when returning paginated data?

A

It makes it easier for the client to navigate through the pages without the need to construct the urls.

57
Q

How to make it easy for application developers to paginate objects in a database?

A

Usually links of previous, next, first and last are sufficient for handling large collections, but sometimes you may want to allow clients explicit control over pagination.

Facebook uses “offset” and “limit”.
Twitter uses “page” and “rpp” (records per page)
LinkedIn uses “start” and “count”.

Facebook and LinkedIn do the same thing but use different names.

To get records 50 through 75 from each system you would use:
Facebook: offset 50, limit 25
Twitter: page 3 and rpp 25
LinkedIn: start 50, count 25

Recommended approach is to use limit and offset.

58
Q

Why is good error design especially important for API designers?

A
  • everything on the other side of that interface is a black box
  • developers learn to write code through errors due to TDD and extreme programming
  • developers depend on well-designed errors at the critical times when they are troubleshooting, and resolving issues
59
Q

Which is the best way to return errors from REST API?

A

Use of HTTP status codes with proper headers if very important. HTTP status codes should not be considered as return values from your function but they almost always are paired with headers.

For HTTP Get 200 it is not only data but also headers like Content-Location, Content-type, ETag, Content-Length etc

For HTTP 405 Method not allowed, must be paired with Allow header which includes the methods that are allowed. PUT, GET, DELETE

Make messages returned in the payload as verbose as possible

60
Q

If an error occurs which levels of information should be present in response. Include different audience like application developer, end user etc

A

{“developerMessage” : “Some technical language that points to the cause of the issue”, “userMessage” : “Pass this message on to the app user if needed”, “errorCode” :11234, “moreInfo”: “https://dev.teachdogrest.com/errors/12345”}