Skip to content

Conversation

@korelstar
Copy link
Member

@korelstar korelstar commented Apr 13, 2020

The API documentation is moved from the wiki to the main repository.

@korelstar korelstar added the feature: API Related to the API for 3rd-party apps, i.e. Android or iOS label Apr 13, 2020
@korelstar korelstar added this to the 3.3.0 milestone Apr 13, 2020
@korelstar korelstar mentioned this pull request Apr 13, 2020
7 tasks
- when sending a request which uses a feature that wasn't available from beginning of the used major version, the client has to cope with the situation that the server ignores parts of the request
- when processing the JSON response, the server may ommit fields that where not available from beginning of the used major version

If a client requires a certain feature, it should check the `X-Notes-API-Versions` HTTP header of the server response.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also send a special HTTP header for the full API version used in the current request/response? Example: a client requests /index.php/apps/notes/api/v1/notes and wants to know if a specific minor version is supported by the server (e.g. because that version introduced a new feature). Currently, the client has to check the X-Notes-API-Versions HTTP header from the response (which could be, e.g., 0.2, 1.1), search for the major version 1 and look at the minor version.

In order to ease this check, we could add another X-Notes-API-Version (singular!) HTTP header which contains the currently used API version only, e.g. 1.1.

@nextcloud/notes @stefan-niedermann

Copy link
Member

@stefan-niedermann stefan-niedermann Apr 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it. I technically don't need it, but it might be quiet useful for debugging and/or logging.

On the other hand: If we add many headers which aren't actually needed i am worrying about the traffic we are causing. We did so much work with the ETags and If-Modified-Since-stuff to drastically reduce the size of the responses and speed up everything and now we are adding many "long" headers which aren't necessarily needed.

Maybe a better option would be the possibility for the client to explicitely set a debug-header. If set, the server can add such kind of information (and maybe even set the server level for the context of the request to a more sensitive level)?

What do you think about this approach?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the client should not be able to set the debug level - for security reasons. But we could check if server debug mode is active and send some debug information then. E.g, exact message and stack trace in case of an exception. What's about that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds even better, but the stacktrace would have to be in the body, no? That might change the expection of the response...

I would start with "If server is in debug mode, attach the X-Notes-API-Version header as you proposed.

Seems to be an easy compromise.

@korelstar korelstar marked this pull request as draft April 13, 2020 19:14
@korelstar korelstar marked this pull request as ready for review May 5, 2020 06:27
@korelstar korelstar merged commit d461f7e into master May 5, 2020
@korelstar korelstar deleted the api-docs branch May 5, 2020 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: API Related to the API for 3rd-party apps, i.e. Android or iOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants