[PR #529] [CLOSED] Draft of new REST API using DRF #2722

Closed
opened 2026-03-01 18:00:33 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ArchiveBox/ArchiveBox/pull/529
Author: @mAAdhaTTah
Created: 11/8/2020
Status: Closed

Base: masterHead: initial-rest-api


📝 Commits (1)

📊 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_links method loads all of the snapshots, which would
require 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_django function doesn't fully work when passing out_path;
Some variables in the Django settings aren't updated or configured correctly.
Instead, we use subprocess the same way the other tests do to start up the
server 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

  • Bugfixes
  • Feature behavior
  • Command line interface
  • Configuration options
  • Internal architecture
  • Snapshot data layout on disk

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ArchiveBox/ArchiveBox/pull/529 **Author:** [@mAAdhaTTah](https://github.com/mAAdhaTTah) **Created:** 11/8/2020 **Status:** ❌ Closed **Base:** `master` ← **Head:** `initial-rest-api` --- ### 📝 Commits (1) - [`44515e6`](https://github.com/ArchiveBox/ArchiveBox/commit/44515e68362c521375b5eeae9ac3b6f87efa8273) Draft of REST API ### 📊 Changes **10 files changed** (+106 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 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_links` method loads all of the snapshots, which would require 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_django` function doesn't fully work when passing `out_path`; Some variables in the Django settings aren't updated or configured correctly. Instead, we use `subprocess` the same way the other tests do to start up the server 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 - [ ] Bugfixes - [X] Feature behavior - [ ] Command line interface - [ ] Configuration options - [ ] Internal architecture - [ ] Snapshot data layout on disk --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 18:00:33 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#2722
No description provided.