Page MenuHomeSoftware Heritage

JSONP support in the public API
Closed, MigratedEdits Locked

Description

To work around JavaScript same-origin policy, allowing to call into base.swh from www.swh, we should add JSONP support to the public facing API.

Other common solutions are currently not viable for us:

  • CORS requires fiddling with HTTP headers (impossible using Gandi simple-hosting)
  • HTTP-level redirection (e.g., www.swh/api/* → api.swh/api/) cannot be setup as a Gandi webredir, which only supports whole-domain redirections

JSONP is feasible. We need to add support for ?jsonp=functionname to all functions in our API front-end.

Revisions and Commits

Related Objects

StatusAssignedTask
Migratedgitlab-migration

Event Timeline

zack raised the priority of this task from to Normal.
zack updated the task description. (Show Details)
zack added projects: Restricted Project, Staff.
zack added a project: Web app.
zack added a subscriber: zack.
zack removed a project: Restricted Project.Oct 16 2015, 8:50 PM
zack raised the priority of this task from Normal to High.

Installed on /api/1/stat/counters

so /api/1/stat/counters?callback=fn
renders:

fn({
     "content": 0,
     "directory": 0,
     "directory_entry_dir": 0,
     "directory_entry_file": 0,
     "directory_entry_rev": 0,
     "occurrence": 0,
     "occurrence_history": 0,
     "origin": 0,
     "person": 0,
     "project": 0,
     "project_history": 0,
     "release": 0,
     "revision": 0,
     "revision_history": 0,
     "skipped_content": 0
     })
olasd changed the visibility from "All Users" to "Public (No Login Required)".May 13 2016, 5:06 PM