Publishers API Documentation

Documentation for the Publishers REST API endpoint.

Endpoints

GET /api/v1/libraries/{library_id}/publishers

Retrieve a list of publishers for a specific library.

Path Parameters

Name Type Description Required
library_id integer ID of the library Yes

Query Parameters

Name Type Description
page integer Page number for pagination (default: 1)

Response

{
    "pagination": {
        "total_entries": 25,
        "per_page": 5,
        "current_page": 1,
        "total_pages": 5,
        "next_page": 2,
        "next_page_url": "http://127.0.0.1:3000/api/v1/libraries/2/publishers?page=2"
    },
    "publishers": [
        {
            "id": 1,
            "library_id": 2,
            "name": "Mike's Awesome Music",
            "pro_id": 10,
            "ipi_number": 292898239823,
            "created_at": "2024-08-19T13:30:26.166-05:00",
            "updated_at": "2024-08-19T13:36:56.251-05:00",
            "url": "http://127.0.0.1:3000/api/v1/libraries/2/publishers/1"
        },
        etc.
    ]
}

Response Fields

Field Type Description
pagination object Contains pagination information
publishers array List of publisher objects
id integer Unique identifier for the publisher
library_id integer ID of the library the publisher belongs to
name string Name of the publisher
pro_id integer Society code of the publisher
ipi_number integer IPI (Interested Parties Information) number
created_at string Timestamp of when the publisher was created
updated_at string Timestamp of when the publisher was last updated
url string URL to access the individual publisher’s details

HTTP Response Codes

Code Description
200 OK Successful request
404 Not Found Invalid library ID

POST /api/v1/publishers

Create a new publisher.

Request Body

Field Type Description Required
external_id integer Your unique identifier for the publisher Yes
name string Name of the publisher Yes
pro_id string Society code of the publisher No
ipi_number string IPI (Interested Parties Information) number No

Response

{
    "publisher": {
        "id": 12,
        "name": "Mike's Awesome Music",
        "pro_id": 21,
        "ipi_number": "2389239892"
    }
}

HTTP Response Codes

Code Description
201 Created Successful request
404 Not Found Invalid library ID
422 Unprocessable Entity Invalid request (see response body for details)

GET /api/v1/libraries/{library_id}/publishers/{id}

Retrieve details of a specific publisher.

Path Parameters

Name Type Description Required
library_id integer ID of the library Yes
id integer ID of the publisher Yes

Response

{
    "id": 1,
    "library_id": 2,
    "name": "Ilze E. Platais",
    "birth_date": null,
    "death_date": null,
    "pro_id": 10,
    "ipi_number": 49448942,
    "created_at": "2024-08-19T13:30:26.166-05:00",
    "updated_at": "2024-08-19T13:36:56.251-05:00",
    "url": "http://127.0.0.1:3000/api/v1/libraries/2/publishers/1"
}

HTTP Response Codes

Code Description
200 OK Successful request
404 Not Found Invalid library ID

PUT /api/v1/libraries/{library_id}/publishers/{id}

Update details of a specific publisher.

Path Parameters

Name Type Description Required
library_id integer ID of the library Yes
id integer ID of the publisher Yes

Request Body

{
    "name": "Updated Publisher Name",
    "pro_id": 20,
    "ipi_number": 123456789
}

Response

{
    "id": 1,
    "library_id": 2,
    "name": "Updated Publisher Name",
    "pro_id": 20,
    "ipi_number": 123456789,
    "created_at": "2024-08-19T13:30:26.166-05:00",
    "updated_at": "2024-08-20T10:15:30.123-05:00",
    "url": "http://127.0.0.1:3000/api/v1/libraries/2/publishers/1"
}

HTTP Response Codes

Code Description
200 OK Successful request
404 Not Found Invalid library ID or publisher ID
422 Unprocessable Entity Invalid request (see response body for details)

DELETE /api/v1/libraries/{library_id}/publishers/{id}

Delete a specific publisher.

Path Parameters

Name Type Description Required
library_id integer ID of the library Yes
id integer ID of the publisher Yes

Response

(no response body)

HTTP Response Codes

Code Description
204 No Content Successful request
404 Not Found Invalid library ID or publisher ID