From 8c8f24f07760209a0c9cd40f14c87d1728f367d4 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Thu, 13 Apr 2017 10:15:26 +0200 Subject: [PATCH] Fixed issue #690 - API call /api/v1/online_notifications/{id} yields "no route". --- .../online_notifications_controller.rb | 27 +++++++++++++++++++ config/routes/online_notification.rb | 1 + 2 files changed, 28 insertions(+) diff --git a/app/controllers/online_notifications_controller.rb b/app/controllers/online_notifications_controller.rb index f71969f77..6bd994aac 100644 --- a/app/controllers/online_notifications_controller.rb +++ b/app/controllers/online_notifications_controller.rb @@ -58,6 +58,33 @@ curl http://localhost/api/v1/online_notifications.json -v -u #{login}:#{password =begin +Resource: +GET /api/v1/online_notifications/{id} + +Payload: +{ + "id": "123", +} + +Response: +{ + "id": 1, + "name": "some_name", + ... +} + +Test: +curl http://localhost/api/v1/online_notifications/#{id} -v -u #{login}:#{password} + +=end + + def show + return if !access? + model_show_render(OnlineNotification, params) + end + +=begin + Resource: PUT /api/v1/online_notifications/{id} diff --git a/config/routes/online_notification.rb b/config/routes/online_notification.rb index 92e4e9932..c2f4f56c9 100644 --- a/config/routes/online_notification.rb +++ b/config/routes/online_notification.rb @@ -3,6 +3,7 @@ Zammad::Application.routes.draw do # groups match api_path + '/online_notifications', to: 'online_notifications#index', via: :get + match api_path + '/online_notifications/:id', to: 'online_notifications#show', via: :get match api_path + '/online_notifications/:id', to: 'online_notifications#update', via: :put match api_path + '/online_notifications/:id', to: 'online_notifications#destroy', via: :delete match api_path + '/online_notifications/mark_all_as_read', to: 'online_notifications#mark_all_as_read', via: :post