diaspora / diaspora/api-documentation

Let's introduce routes for user profile export

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
routes-migration status-confirmed type-improvement
Dominant language
SCSS
Stars
22
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Current diaspora API doesn't contain any routes for requesting user profile.

We talked that besides full archive we also want a lightweight version of the archive, which includes the essentials: basic profile, private key and, perhaps, contacts.

For the full archive we currently have a two step process: you request the archive and then when it is available, you download the archive. We need a similar approach with the API. However, I think that the lightweight archive could be exported in one go, just with a signle GET request.

Also since archive contains sensitive information (e.g. private key) it needs an additional access scope.

Currently scopes [are defined](https://github.com/diaspora/diaspora/blob/b3d3445a7e8deb8659d69c14cf4985ae40eadb46/app/models/api/openid_connect/authorization.rb#L21) as
```ruby
SCOPES = %w(openid sub aud name nickname profile picture read write)
```

We might add a scope called `archive` to control access to archive related API methods. Another option could be to create a scope called `private_key` and require several scopes to be authorized to request the archive, e.g. `private_key`+`profile` for the basic profiles and `private_key`+`profile`+`read` for the full profile.

So for the lightweight archive it is just `GET /api/v1/user/archive/basic` which returns the archive JSON.

For the full archive, I'm not quite sure. What I though could be `GET /api/v1/user/archive/full/request` as a method to request a new archive export. Then, when archive is ready, a link to the archive is retrieved by `GET /api/v1/user/archive/full/url`. It returns a URL to the archive file. When new archive export is requested this route returns nothing until the archive is ready. The same approach can be used for photos with following routes respectively: `GET /api/v1/user/archive/photos/request`, `GET /api/v1/user/archive/photos/url`.

Also we need a way to inform the client about the export finish/failure. However I'm unsure if we have to do that in the archive API namespace. Maybe we can just reuse notifications for that? BTW, it looks a bit inconsistent that we have an email for (un)successful export, but don't have UI notifications for that. Maybe it worth change that and then we can use it as a tracker for export state in clients?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.