diff --git a/README.md b/README.md index dd0dd0c41481e6233f8d0e0cb5f684513717b2e8..92d895d7c72e718ae254c8bdf9bbf8a811694809 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,7 @@ You can find details on the available API endpoints here: https://app.swaggerhub Adding some entry to the playlog: ```bash -curl -d '{ "track_start": "2020-06-27 19:14:00", "track_artist": "Mazzie Star", "track_title": "Fade Into You", "log_source": 1 }' -H "Content-Type: application/json" -X POST http://localhost:8008/api/v1/playlog/store +curl -d '{ "track_start": "2020-06-27 19:14:00", "track_artist": "Mazzie Star", "track_title": "Fade Into You", "log_source": 1 }' -H "Content-Type: application/json" -X POST http://localhost:8008/api/v1/playlog ``` This newly added entry can be queried using your browser in one of the following ways: diff --git a/config/sample/sample-development.engine-api.ini b/config/sample/sample-development.engine-api.ini index cb9ce5e3b95902ffe954e822cb054bddf761d8fc..faebbb637f2cc6cd680c0d6689ccaddfe2d74cf2 100644 --- a/config/sample/sample-development.engine-api.ini +++ b/config/sample/sample-development.engine-api.ini @@ -58,6 +58,6 @@ sync_host="http://localhost:8010" # API endpoints to sync data from main to child nodes sync_api_get_playlog="/api/v1/playlog" -sync_api_store_playlog="/api/v1/playlog/store" +sync_api_store_playlog="/api/v1/playlog" sync_api_store_healthlog="/api/v1/source/health" sync_api_store_clockinfo="/api/v1/clock" \ No newline at end of file diff --git a/config/sample/sample-production.engine-api.ini b/config/sample/sample-production.engine-api.ini index 084980e6a77d0e45d0103fdf5d45d39813771b5b..919c2fe7b7032d7272913bccbc70f37957a81ab2 100644 --- a/config/sample/sample-production.engine-api.ini +++ b/config/sample/sample-production.engine-api.ini @@ -58,6 +58,6 @@ enable_federation="false" # API endpoints to sync data from main to child nodes sync_api_get_playlog="/api/v1/playlog" -sync_api_store_playlog="/api/v1/playlog/store" +sync_api_store_playlog="/api/v1/playlog" sync_api_store_healthlog="/api/v1/source/health" sync_api_store_clockinfo="/api/v1/clock" \ No newline at end of file diff --git a/src/rest/controllers/internal_controller.py b/src/rest/controllers/internal_controller.py index 3d431109e053fb5d8a30e76affd412dc7dc5a5fe..93817db3d923e51c4c080a2b081aeb5f682bac4f 100644 --- a/src/rest/controllers/internal_controller.py +++ b/src/rest/controllers/internal_controller.py @@ -144,7 +144,7 @@ def set_active_source(number): # noqa: E501 def set_clock_info(body): # noqa: E501 """Set current studio clock information such as timeslot info and track-list for engine 1 or 2 - Set current studio clock information (source, timeslot and track-list) and the next timeslot of the given play-out source (engine1, engine2). Please note, the `current_track` information is ignored in the PUT request. It's only populated in the GET request. To store current track information use `/playlog/store` instead. # noqa: E501 + Set current studio clock information (source, timeslot and track-list) and the next timeslot of the given play-out source (engine1, engine2). Please note, the `current_track` information is ignored in the PUT request. It's only populated in the GET request. To store current track information use `/playlog` instead. # noqa: E501 :param body: :type body: dict | bytes diff --git a/src/rest/swagger/swagger.yaml b/src/rest/swagger/swagger.yaml index 26e5fef99138b313b2e5e9b850a93840a25bbad7..880aefeec072579ee2ff4d2dd9fab76b31f544e3 100644 --- a/src/rest/swagger/swagger.yaml +++ b/src/rest/swagger/swagger.yaml @@ -139,7 +139,7 @@ paths: summary: Set current studio clock information such as timeslot info and track-list for engine 1 or 2 within the Engine API database. description: | - Set current studio clock information (source, timeslot and track-list) and the next timeslot of the given play-out source (engine1, engine2). Please note, the `current_track` information is ignored in the PUT request. It's only dynamically populated in the GET request by reading the most recent playlog. To store current track information use `/playlog/store` instead. Also note, similar to the `PlayLog` storage endpoint, this information is only stored to the database if a) it is a main node or b) if it's a sync node, and the `engine_source` is the currently active engine. + Set current studio clock information (source, timeslot and track-list) and the next timeslot of the given play-out source (engine1, engine2). Please note, the `current_track` information is ignored in the PUT request. It's only dynamically populated in the GET request by reading the most recent playlog. To store current track information use `/playlog` instead. Also note, similar to the `PlayLog` storage endpoint, this information is only stored to the database if a) it is a main node or b) if it's a sync node, and the `engine_source` is the currently active engine. operationId: set_clock_info requestBody: content: @@ -153,30 +153,6 @@ paths: "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller - /playlog/store: - post: - tags: - - internal - summary: Adds an entry to the playlog - description: | - Stores the passed playlog entry in the local database. Also note, similar to the `ClockInfo` storage endpoint, this information is only stored to the database if a) it is a main node or b) if it's a sync node, and the `log_source` is the currently active engine. - operationId: add_playlog - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PlayLog' - required: true - responses: - "200": - description: Successfully created a new playlog - "400": - description: Invalid request - content: - application/json: - schema: - $ref: '#/components/schemas/inline_response_400' - x-openapi-router-controller: src.rest.controllers.internal_controller /playlog: get: tags: @@ -248,6 +224,29 @@ paths: "400": description: bad input parameter x-openapi-router-controller: src.rest.controllers.internal_controller + post: + tags: + - internal + summary: Adds an entry to the playlog + description: | + Stores the passed playlog entry in the local database. Also note, similar to the `ClockInfo` storage endpoint, this information is only stored to the database if a) it is a main node or b) if it's a sync node, and the `log_source` is the currently active engine. + operationId: add_playlog + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PlayLog' + required: true + responses: + "200": + description: Successfully created a new playlog + "400": + description: Invalid request + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_400' + x-openapi-router-controller: src.rest.controllers.internal_controller /playlog/report/{year_month}: get: tags: diff --git a/src/rest/test/test_internal_controller.py b/src/rest/test/test_internal_controller.py index 4f34752dbca335c464d82aa5daf2c53cb38893c6..5c5c129acc2739074e574d8971d5cddecb8462e3 100644 --- a/src/rest/test/test_internal_controller.py +++ b/src/rest/test/test_internal_controller.py @@ -40,7 +40,7 @@ class TestInternalController(BaseTestCase): """ body = PlayLog() response = self.client.open( - '/api/v1/playlog/store', + '/api/v1/playlog', method='POST', data=json.dumps(body), content_type='application/json') diff --git a/tests/config/engine-0-api.ini b/tests/config/engine-0-api.ini index 37ce8a513917724e0f9a30d30a3b0bed21bdcd51..aa5a3a03772336d40849ca323db17e20fd1977f0 100644 --- a/tests/config/engine-0-api.ini +++ b/tests/config/engine-0-api.ini @@ -55,6 +55,6 @@ sync_step_sleep=3 # API endpoints to sync data from main to child nodes sync_api_get_playlog="/api/v1/playlog" -sync_api_store_playlog="/api/v1/playlog/store" +sync_api_store_playlog="/api/v1/playlog" sync_api_store_healthlog="/api/v1/source/health" sync_api_store_clockinfo="/api/v1/clock" \ No newline at end of file diff --git a/tests/config/engine-1-api.ini b/tests/config/engine-1-api.ini index 69abc053aa74c20ebb01ec95be301d534e4b25f4..bc6baccd7d9b6c937f22b3b46cd5d62103517e3b 100644 --- a/tests/config/engine-1-api.ini +++ b/tests/config/engine-1-api.ini @@ -55,6 +55,6 @@ sync_host="http://localhost:8010" # API endpoints to sync data from main to child nodes sync_api_get_playlog="/api/v1/playlog" -sync_api_store_playlog="/api/v1/playlog/store" +sync_api_store_playlog="/api/v1/playlog" sync_api_store_healthlog="/api/v1/source/health" sync_api_store_clockinfo="/api/v1/clock" \ No newline at end of file diff --git a/tests/config/engine-2-api.ini b/tests/config/engine-2-api.ini index 78e534aea860d86bd19be358370c65ad028e7242..d413affaff1bac5c51adf88335d0a7de4cc7222b 100644 --- a/tests/config/engine-2-api.ini +++ b/tests/config/engine-2-api.ini @@ -55,6 +55,6 @@ sync_host="http://localhost:8010" # API endpoints to sync data from main to child nodes sync_api_get_playlog="/api/v1/playlog" -sync_api_store_playlog="/api/v1/playlog/store" +sync_api_store_playlog="/api/v1/playlog" sync_api_store_healthlog="/api/v1/source/health" sync_api_store_clockinfo="/api/v1/clock" \ No newline at end of file