denshoproject / namesdb-public

0 stars 0 forks source link

Add Ireizo-specific API #13

Open gjost opened 10 months ago

gjost commented 10 months ago

Add another pared-down API endpoint to be used by Ireizo.

Irei API URLs should have their own namespace (/irei/api/1.0/...) separate from the NamesDB namespace (/names/api/1.0/).

Sample URL (using irei_id MongoDB(?) key): https://ddr.densho.org/irei/api/1.0/persons/956ce608-1388-4c5a-bc6b-e3c77969d7c8

Sample JSON output

{
    "irei_id": "956ce608-1388-4c5a-bc6b-e3c77969d7c8"
    "nr_id": "88922/nr007bb08",
    "links": {
        "html": "https://ddr.densho.org/names/persons/88922/nr007bb08",
        "json": "https://ddr.densho.org/names/api/1.0/persons/88922/nr007bb08"
    },
    "last_name": "Sumida",
    "first_name": "Chimata",
    "preferred_name": "Chimata Sumida",
    "birth_year": 1888,
    "wra_family_no": "12976",
    "gender": "M",
    "related_persons": [
        {
            "nr_id": "88922/nr0072j39",
            "preferred_name": "Fred Yutaka Nakayama",
            "birth_year": "1890",
            "links": {
                "html": "https://ddr.densho.org/names/persons/88922/nr0072j39",
                "json": "https://ddr.densho.org/names/api/1.0/persons/88922/nr0072j39"
            }
        },
        ...
    ],
    "objects": [
        {
            "id": "ddr-densho-379-57",
            "links": {
                "html": "https://ddr.densho.org/ddr-densho-379-57/",
                "json": "https://ddr.densho.org/api/0.2/ddr-densho-379-57/",
                "img": "https://ddr.densho.org/media/ddr-densho-379/ddr-densho-379-57-mezzanine-cd2b2f71df-a.jpg",
            },
            "title": "Portrait of Chimata Sumida",
            "format": "img",
        },
        ...
    ],
    "objects_more": "https://ddr.densho.org/nrid/88922/nr007bb08/",
}