mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-25 09:06:02 +03:00
[PR #529] [CLOSED] Draft of new REST API using DRF #4223
Labels
No labels
expected: maybe someday
expected: next release
expected: release after next
expected: unlikely unless contributed
good first ticket
help wanted
pull-request
scope: all users
scope: windows users
size: easy
size: hard
size: medium
size: medium
status: backlog
status: blocked
status: done
status: idea-phase
status: needs followup
status: wip
status: wontfix
touches: API/CLI/Spec
touches: configuration
touches: data/schema/architecture
touches: dependencies/packaging
touches: docs
touches: js
touches: views/replayers/html/css
why: correctness
why: functionality
why: performance
why: security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ArchiveBox#4223
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ArchiveBox/ArchiveBox/pull/529
Author: @mAAdhaTTah
Created: 11/8/2020
Status: ❌ Closed
Base:
master← Head:initial-rest-api📝 Commits (1)
44515e6Draft of REST API📊 Changes
10 files changed (+106 additions, -3 deletions)
View changed files
📝
archivebox.egg-info/SOURCES.txt(+3 -0)📝
archivebox.egg-info/requires.txt(+1 -0)➕
archivebox/api/__init__.py(+7 -0)➕
archivebox/api/serializers.py(+8 -0)➕
archivebox/api/views.py(+10 -0)📝
archivebox/core/settings.py(+5 -0)📝
archivebox/core/urls.py(+2 -2)📝
setup.py(+1 -0)📝
tests/fixtures.py(+44 -1)➕
tests/test_api.py(+25 -0)📄 Description
This pulls in DRF to configure our API. Pretty straightforward binding of a view
to a serializer & a model and making the data available. For this first pass,
we're using the model even though it's currently unstable. From a feature
standpoint, we get a lot for free from DRF with very little code, including
pagination. The
list_linksmethod loads all of the snapshots, which wouldrequire pagination to be implemented manually on the entire list of snapshots,
which won't work well on large databases. Because archivebox is a CLI first
and a web application second, the way Exceptions are thrown and errors
logged doesn't always make those methods conducive to integrating w/ an API.
On the testing side, this shows up in how we're configuring things. The
setup_djangofunction doesn't fully work when passingout_path;Some variables in the Django settings aren't updated or configured correctly.
Instead, we use
subprocessthe same way the other tests do to start up theserver and hit it with
requests.Summary
This is obviously a work in progress but wanted to get some feedback on the
direction. It would be helpful if the API functions exposed by archivebox were
more decoupled from the CLI context specifically, but I think we're going to
want to bind the Models directly (at least for querying).
Related issues
#496
Changes these areas
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.