From 41e18eefd24f5490417dea297750065aaa6b48ac Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 21 Dec 2017 18:10:43 +0100 Subject: [PATCH] Web API: replaced status code 200 by 202 whenever an asynchronous message is enqueued --- sdrbase/resources/index.html | 146 +++++++++--------- sdrbase/webapi/webapiadapterinterface.h | 2 +- sdrbase/webapi/webapirequestmapper.cpp | 66 ++++---- sdrgui/webapi/webapiadaptergui.cpp | 18 +-- sdrsrv/webapi/webapiadaptersrv.cpp | 23 +-- sdrsrv/webapi/webapiadaptersrv.h | 2 +- swagger/sdrangel/api/swagger/swagger.yaml | 36 ++--- swagger/sdrangel/code/html2/index.html | 146 +++++++++--------- swagger/sdrangel/examples/add_channel.py | 2 +- .../sdrangel/examples/devicesets_config.py | 2 +- swagger/sdrangel/examples/limesdr_tx.py | 2 +- swagger/sdrangel/examples/nfm_test.py | 2 +- swagger/sdrangel/examples/ptt.py | 6 +- swagger/sdrangel/examples/rtlsdr_settings.py | 10 +- swagger/sdrangel/examples/start_stop.py | 6 +- swagger/sdrangel/examples/stop_server.py | 2 +- 16 files changed, 236 insertions(+), 235 deletions(-) diff --git a/sdrbase/resources/index.html b/sdrbase/resources/index.html index b8ac59edc..4054bca79 100644 --- a/sdrbase/resources/index.html +++ b/sdrbase/resources/index.html @@ -2469,22 +2469,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return informative message

+

Status: 202 - Message to add a channel was sent successfully

-
-
+
+
- +
@@ -4324,22 +4324,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return details on the selected device

+

Status: 202 - On successful semdomg of the message it returns the details of the device being set

-
-
+
+
- +
@@ -8955,22 +8955,22 @@ except ApiException as e:

Responses

-

Status: 200 - On success returns instance summary before it was closed

+

Status: 202 - Message to stop the SDRangel instance was sent successfully

-
-
+
+
- +
@@ -9255,22 +9255,22 @@ except ApiException as e:

Responses

-

Status: 200 - On success return informative message

+

Status: 202 - Message to remove last device set was sent successfully

-
-
+
+
- +
@@ -9936,22 +9936,22 @@ except ApiException as e:

Responses

-

Status: 200 - On success return informative messsage

+

Status: 202 - Message to add a new device set was sent successfully

-
-
+
+
- +
@@ -11981,22 +11981,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return deleted preset identification

+

Status: 202 - On successful sending of the message the selected preset identification is returned

-
-
+
+
- +
@@ -13595,22 +13595,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return preset identification

+

Status: 202 - On successful sending of the message the selected preset identification is returned

-
-
+
+
- +
@@ -14033,22 +14033,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return preset identification

+

Status: 202 - On successful sending of the message the created preset identification is returned

-
-
+
+
- +
@@ -14514,22 +14514,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return preset identification

+

Status: 202 - On successful sending of the message the selected preset identification is returned

-
-
+
+
- +
@@ -15011,7 +15011,7 @@ except ApiException as e:
- Generated 2017-12-21T00:41:40.926+01:00 + Generated 2017-12-21T15:48:45.512+01:00
diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index 1749af9ef..6964c9981 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -71,7 +71,7 @@ public: * returns the Http status code (default 501: not implemented) */ virtual int instanceDelete( - SWGSDRangel::SWGInstanceSummaryResponse& response __attribute__((unused)), + SWGSDRangel::SWGSuccessResponse& response __attribute__((unused)), SWGSDRangel::SWGErrorResponse& error) { error.init(); diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index a3c65bf6e..50dfef189 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -139,7 +139,7 @@ void WebAPIRequestMapper::instanceSummaryService(qtwebapp::HttpRequest& request, int status = m_adapter->instanceSummary(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -147,12 +147,12 @@ void WebAPIRequestMapper::instanceSummaryService(qtwebapp::HttpRequest& request, } else if (request.getMethod() == "DELETE") { - SWGSDRangel::SWGInstanceSummaryResponse normalResponse; + SWGSDRangel::SWGSuccessResponse normalResponse; int status = m_adapter->instanceDelete(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -185,7 +185,7 @@ void WebAPIRequestMapper::instanceDevicesService(qtwebapp::HttpRequest& request, int status = m_adapter->instanceDevices(tx, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -218,7 +218,7 @@ void WebAPIRequestMapper::instanceChannelsService(qtwebapp::HttpRequest& request int status = m_adapter->instanceChannels(tx, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -244,7 +244,7 @@ void WebAPIRequestMapper::instanceLoggingService(qtwebapp::HttpRequest& request, int status = m_adapter->instanceLoggingGet(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -261,7 +261,7 @@ void WebAPIRequestMapper::instanceLoggingService(qtwebapp::HttpRequest& request, int status = m_adapter->instanceLoggingPut(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -296,7 +296,7 @@ void WebAPIRequestMapper::instanceAudioService(qtwebapp::HttpRequest& request, q int status = m_adapter->instanceAudioGet(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -314,7 +314,7 @@ void WebAPIRequestMapper::instanceAudioService(qtwebapp::HttpRequest& request, q int status = m_adapter->instanceAudioPatch(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -349,7 +349,7 @@ void WebAPIRequestMapper::instanceLocationService(qtwebapp::HttpRequest& request int status = m_adapter->instanceLocationGet(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -367,7 +367,7 @@ void WebAPIRequestMapper::instanceLocationService(qtwebapp::HttpRequest& request int status = m_adapter->instanceLocationPut(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -409,7 +409,7 @@ void WebAPIRequestMapper::instanceDVSerialService(qtwebapp::HttpRequest& request int status = m_adapter->instanceDVSerialPatch(dvserial, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -435,7 +435,7 @@ void WebAPIRequestMapper::instancePresetsService(qtwebapp::HttpRequest& request, int status = m_adapter->instancePresetsGet(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -464,7 +464,7 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request, int status = m_adapter->instancePresetPatch(query, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -502,7 +502,7 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request, int status = m_adapter->instancePresetPut(query, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -540,7 +540,7 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request, int status = m_adapter->instancePresetPost(query, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -577,7 +577,7 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request, int status = m_adapter->instancePresetDelete(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -629,7 +629,7 @@ void WebAPIRequestMapper::instancePresetFileService(qtwebapp::HttpRequest& reque int status = m_adapter->instancePresetFilePut(query, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -667,7 +667,7 @@ void WebAPIRequestMapper::instancePresetFileService(qtwebapp::HttpRequest& reque int status = m_adapter->instancePresetFilePost(query, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -709,7 +709,7 @@ void WebAPIRequestMapper::instanceDeviceSetsService(qtwebapp::HttpRequest& reque int status = m_adapter->instanceDeviceSetsGet(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -728,7 +728,7 @@ void WebAPIRequestMapper::instanceDeviceSetsService(qtwebapp::HttpRequest& reque int status = m_adapter->instanceDeviceSetsPost(tx, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -740,7 +740,7 @@ void WebAPIRequestMapper::instanceDeviceSetsService(qtwebapp::HttpRequest& reque int status = m_adapter->instanceDeviceSetsDelete(normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -769,7 +769,7 @@ void WebAPIRequestMapper::devicesetService(const std::string& indexStr, qtwebapp int status = m_adapter->devicesetGet(deviceSetIndex, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -814,7 +814,7 @@ void WebAPIRequestMapper::devicesetDeviceService(const std::string& indexStr, qt int status = m_adapter->devicesetDevicePut(deviceSetIndex, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -873,7 +873,7 @@ void WebAPIRequestMapper::devicesetDeviceSettingsService(const std::string& inde errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -902,7 +902,7 @@ void WebAPIRequestMapper::devicesetDeviceSettingsService(const std::string& inde int status = m_adapter->devicesetDeviceSettingsGet(deviceSetIndex, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -941,7 +941,7 @@ void WebAPIRequestMapper::devicesetDeviceRunService(const std::string& indexStr, response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -954,7 +954,7 @@ void WebAPIRequestMapper::devicesetDeviceRunService(const std::string& indexStr, response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -967,7 +967,7 @@ void WebAPIRequestMapper::devicesetDeviceRunService(const std::string& indexStr, response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -1027,7 +1027,7 @@ void WebAPIRequestMapper::devicesetChannelService( response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -1088,7 +1088,7 @@ void WebAPIRequestMapper::devicesetChannelIndexService( response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -1132,7 +1132,7 @@ void WebAPIRequestMapper::devicesetChannelSettingsService( int status = m_adapter->devicesetChannelSettingsGet(deviceSetIndex, channelIndex, normalResponse, errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); @@ -1158,7 +1158,7 @@ void WebAPIRequestMapper::devicesetChannelSettingsService( errorResponse); response.setStatus(status); - if (status == 200) { + if (status/100 == 2) { response.write(normalResponse.asJson().toUtf8()); } else { response.write(errorResponse.asJson().toUtf8()); diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index 4c2a15f02..bbaa56210 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -421,7 +421,7 @@ int WebAPIAdapterGUI::instancePresetPatch( *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T"; *response.getName() = selectedPreset->getDescription(); - return 200; + return 202; } int WebAPIAdapterGUI::instancePresetPut( @@ -477,7 +477,7 @@ int WebAPIAdapterGUI::instancePresetPut( *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T"; *response.getName() = selectedPreset->getDescription(); - return 200; + return 202; } int WebAPIAdapterGUI::instancePresetPost( @@ -521,7 +521,7 @@ int WebAPIAdapterGUI::instancePresetPost( *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T"; *response.getName() = selectedPreset->getDescription(); - return 200; + return 202; } int WebAPIAdapterGUI::instancePresetDelete( @@ -549,7 +549,7 @@ int WebAPIAdapterGUI::instancePresetDelete( MainWindow::MsgDeletePreset *msg = MainWindow::MsgDeletePreset::create(const_cast(selectedPreset)); m_mainWindow.m_inputMessageQueue.push(msg); - return 200; + return 202; } int WebAPIAdapterGUI::instanceDeviceSetsGet( @@ -571,7 +571,7 @@ int WebAPIAdapterGUI::instanceDeviceSetsPost( response.init(); *response.getMessage() = QString("MsgAddDeviceSet message submitted"); - return 200; + return 202; } int WebAPIAdapterGUI::instanceDeviceSetsDelete( @@ -586,7 +586,7 @@ int WebAPIAdapterGUI::instanceDeviceSetsDelete( response.init(); *response.getMessage() = QString("MsgRemoveLastDeviceSet message submitted"); - return 200; + return 202; } else { @@ -680,7 +680,7 @@ int WebAPIAdapterGUI::devicesetDevicePut( response.setDeviceSetIndex(deviceSetIndex); response.setIndex(i); - return 200; + return 202; } *error.getMessage() = QString("Device not found"); @@ -933,7 +933,7 @@ int WebAPIAdapterGUI::devicesetChannelPost( response.init(); *response.getMessage() = QString("MsgAddChannel message submitted"); - return 200; + return 202; } else { @@ -969,7 +969,7 @@ int WebAPIAdapterGUI::devicesetChannelPost( response.init(); *response.getMessage() = QString("MsgAddChannel message submitted"); - return 200; + return 202; } else { diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index c47f9b013..b40d08497 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -87,15 +87,16 @@ int WebAPIAdapterSrv::instanceSummary( } int WebAPIAdapterSrv::instanceDelete( - SWGSDRangel::SWGInstanceSummaryResponse& response, - SWGSDRangel::SWGErrorResponse& error) + SWGSDRangel::SWGSuccessResponse& response, + SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) { - instanceSummary(response, error); - MainCore::MsgDeleteInstance *msg = MainCore::MsgDeleteInstance::create(); m_mainCore.getInputMessageQueue()->push(msg); - return 200; + response.init(); + *response.getMessage() = QString("MsgDeleteInstance message submitted"); + + return 202; } int WebAPIAdapterSrv::instanceDevices( @@ -536,7 +537,7 @@ int WebAPIAdapterSrv::instancePresetPatch( *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T"; *response.getName() = selectedPreset->getDescription(); - return 200; + return 202; } int WebAPIAdapterSrv::instancePresetPut( @@ -592,7 +593,7 @@ int WebAPIAdapterSrv::instancePresetPut( *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T"; *response.getName() = selectedPreset->getDescription(); - return 200; + return 202; } int WebAPIAdapterSrv::instancePresetPost( @@ -648,7 +649,7 @@ int WebAPIAdapterSrv::instancePresetPost( *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T"; *response.getName() = selectedPreset->getDescription(); - return 200; + return 202; } int WebAPIAdapterSrv::instancePresetDelete( @@ -676,7 +677,7 @@ int WebAPIAdapterSrv::instancePresetDelete( MainCore::MsgDeletePreset *msg = MainCore::MsgDeletePreset::create(const_cast(selectedPreset)); m_mainCore.m_inputMessageQueue.push(msg); - return 200; + return 202; } int WebAPIAdapterSrv::instanceDeviceSetsGet( @@ -698,7 +699,7 @@ int WebAPIAdapterSrv::instanceDeviceSetsPost( response.init(); *response.getMessage() = QString("MsgAddDeviceSet message submitted"); - return 200; + return 202; } int WebAPIAdapterSrv::instanceDeviceSetsDelete( @@ -713,7 +714,7 @@ int WebAPIAdapterSrv::instanceDeviceSetsDelete( response.init(); *response.getMessage() = QString("MsgRemoveLastDeviceSet message submitted"); - return 200; + return 202; } else { diff --git a/sdrsrv/webapi/webapiadaptersrv.h b/sdrsrv/webapi/webapiadaptersrv.h index 4053cf2d7..b4d423536 100644 --- a/sdrsrv/webapi/webapiadaptersrv.h +++ b/sdrsrv/webapi/webapiadaptersrv.h @@ -37,7 +37,7 @@ public: SWGSDRangel::SWGErrorResponse& error); virtual int instanceDelete( - SWGSDRangel::SWGInstanceSummaryResponse& response, + SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceDevices( diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index ffc16a049..f50a8dfdb 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -66,8 +66,8 @@ paths: tags: - Instance responses: - "200": - description: On success returns instance summary before it was closed + "202": + description: Message to stop the SDRangel instance was sent successfully schema: # a pointer to a definition $ref: "#/definitions/InstanceSummaryResponse" @@ -320,8 +320,8 @@ paths: schema: $ref: "#/definitions/PresetTransfer" responses: - "200": - description: On success return preset identification + "202": + description: On successful sending of the message the selected preset identification is returned schema: $ref: "#/definitions/PresetIdentifier" "400": @@ -353,8 +353,8 @@ paths: schema: $ref: "#/definitions/PresetTransfer" responses: - "200": - description: On success return preset identification + "202": + description: On successful sending of the message the selected preset identification is returned schema: $ref: "#/definitions/PresetIdentifier" "400": @@ -386,8 +386,8 @@ paths: schema: $ref: "#/definitions/PresetTransfer" responses: - "200": - description: On success return preset identification + "202": + description: On successful sending of the message the created preset identification is returned schema: $ref: "#/definitions/PresetIdentifier" "400": @@ -423,8 +423,8 @@ paths: schema: $ref: "#/definitions/PresetIdentifier" responses: - "200": - description: On success return deleted preset identification + "202": + description: On successful sending of the message the selected preset identification is returned schema: $ref: "#/definitions/PresetIdentifier" "400": @@ -539,8 +539,8 @@ paths: required: false type: integer responses: - "200": - description: On success return informative messsage + "202": + description: Message to add a new device set was sent successfully schema: $ref: "#/definitions/SuccessResponse" "500": @@ -555,8 +555,8 @@ paths: tags: - Instance responses: - "200": - description: On success return informative message + "202": + description: Message to remove last device set was sent successfully schema: $ref: "#/definitions/SuccessResponse" "404": @@ -617,8 +617,8 @@ paths: schema: $ref: "#/definitions/DeviceListItem" responses: - "200": - description: On success return details on the selected device + "202": + description: On successful semdomg of the message it returns the details of the device being set schema: $ref: "#/definitions/DeviceListItem" "400": @@ -839,8 +839,8 @@ paths: schema: $ref: "#/definitions/ChannelSettings" responses: - "200": - description: On success return informative message + "202": + description: Message to add a channel was sent successfully schema: $ref: "#/definitions/SuccessResponse" "400": diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index b8ac59edc..4054bca79 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -2469,22 +2469,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return informative message

+

Status: 202 - Message to add a channel was sent successfully

-
-
+
+
- +
@@ -4324,22 +4324,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return details on the selected device

+

Status: 202 - On successful semdomg of the message it returns the details of the device being set

-
-
+
+
- +
@@ -8955,22 +8955,22 @@ except ApiException as e:

Responses

-

Status: 200 - On success returns instance summary before it was closed

+

Status: 202 - Message to stop the SDRangel instance was sent successfully

-
-
+
+
- +
@@ -9255,22 +9255,22 @@ except ApiException as e:

Responses

-

Status: 200 - On success return informative message

+

Status: 202 - Message to remove last device set was sent successfully

-
-
+
+
- +
@@ -9936,22 +9936,22 @@ except ApiException as e:

Responses

-

Status: 200 - On success return informative messsage

+

Status: 202 - Message to add a new device set was sent successfully

-
-
+
+
- +
@@ -11981,22 +11981,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return deleted preset identification

+

Status: 202 - On successful sending of the message the selected preset identification is returned

-
-
+
+
- +
@@ -13595,22 +13595,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return preset identification

+

Status: 202 - On successful sending of the message the selected preset identification is returned

-
-
+
+
- +
@@ -14033,22 +14033,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return preset identification

+

Status: 202 - On successful sending of the message the created preset identification is returned

-
-
+
+
- +
@@ -14514,22 +14514,22 @@ $(document).ready(function() {

Responses

-

Status: 200 - On success return preset identification

+

Status: 202 - On successful sending of the message the selected preset identification is returned

-
-
+
+
- +
@@ -15011,7 +15011,7 @@ except ApiException as e:
- Generated 2017-12-21T00:41:40.926+01:00 + Generated 2017-12-21T15:48:45.512+01:00
diff --git a/swagger/sdrangel/examples/add_channel.py b/swagger/sdrangel/examples/add_channel.py index a43ffab05..4dee49d14 100644 --- a/swagger/sdrangel/examples/add_channel.py +++ b/swagger/sdrangel/examples/add_channel.py @@ -36,7 +36,7 @@ def main(): base_url = "http://%s/sdrangel" % options.address device_url = base_url + ("/deviceset/%d/channel" % options.device_index) r = requests.post(url=device_url, json={"tx": 0, "channelType": options.channel_id}) - if r.status_code == 200: + if r.status_code / 100 == 2: print("Success") print json.dumps(r.json(), indent=4, sort_keys=True) else: diff --git a/swagger/sdrangel/examples/devicesets_config.py b/swagger/sdrangel/examples/devicesets_config.py index 43fc65212..edb97634e 100644 --- a/swagger/sdrangel/examples/devicesets_config.py +++ b/swagger/sdrangel/examples/devicesets_config.py @@ -61,7 +61,7 @@ def main(): method = requests_methods.get(command[1], None) if method is not None: r = method(url=url, params=command[2], json=command[3]) - if r.status_code == 200: + if r.status_code / 100 == 2: print("Done: %s" % command[4]) else: print("Error %d:%s" % (r.status_code, command[4])) diff --git a/swagger/sdrangel/examples/limesdr_tx.py b/swagger/sdrangel/examples/limesdr_tx.py index c61830e75..606624b58 100644 --- a/swagger/sdrangel/examples/limesdr_tx.py +++ b/swagger/sdrangel/examples/limesdr_tx.py @@ -40,7 +40,7 @@ def callAPI(url, method, params, json, text): request_method = requests_methods.get(method, None) if request_method is not None: r = request_method(url=base_url+url, params=params, json=json) - if r.status_code == 200: + if r.status_code / 100 == 2: print(text + " succeeded") printResponse(r) return r.json() # all 200 yield application/json response diff --git a/swagger/sdrangel/examples/nfm_test.py b/swagger/sdrangel/examples/nfm_test.py index 842d654d9..25196a915 100644 --- a/swagger/sdrangel/examples/nfm_test.py +++ b/swagger/sdrangel/examples/nfm_test.py @@ -40,7 +40,7 @@ def callAPI(url, method, params, json, text): request_method = requests_methods.get(method, None) if request_method is not None: r = request_method(url=base_url+url, params=params, json=json) - if r.status_code == 200: + if r.status_code / 100 == 2: print(text + " succeeded") printResponse(r) return r.json() # all 200 yield application/json response diff --git a/swagger/sdrangel/examples/ptt.py b/swagger/sdrangel/examples/ptt.py index 4a7db5694..4815bd652 100644 --- a/swagger/sdrangel/examples/ptt.py +++ b/swagger/sdrangel/examples/ptt.py @@ -23,7 +23,7 @@ def getInputOptions(): def startDevice(deviceIndex): dev_run_url = base_url+("/deviceset/%d/device/run" % deviceIndex) r = requests.get(url=dev_run_url) - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() state = rj.get("state", None) if state is not None: @@ -44,7 +44,7 @@ def startDevice(deviceIndex): def stopDevice(deviceIndex): dev_run_url = base_url+("/deviceset/%d/device/run" % deviceIndex) r = requests.get(url=dev_run_url) - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() state = rj.get("state", None) if state is not None: @@ -68,7 +68,7 @@ def main(): global base_url base_url = "http://%s/sdrangel" % options.address r = requests.get(url=base_url+"/devicesets") - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() deviceSets = rj.get("deviceSets", None) if deviceSets is not None: diff --git a/swagger/sdrangel/examples/rtlsdr_settings.py b/swagger/sdrangel/examples/rtlsdr_settings.py index 933ff62f6..b415f9153 100644 --- a/swagger/sdrangel/examples/rtlsdr_settings.py +++ b/swagger/sdrangel/examples/rtlsdr_settings.py @@ -13,7 +13,7 @@ requests_methods = { def getHwType(): r = requests.get(url=base_url+"/deviceset/0") - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() devj = rj.get('samplingDevice', None) if devj is not None: @@ -25,7 +25,7 @@ def getHwType(): def selectRtlSdr(): r = requests.put(url=base_url+"/deviceset/0/device", json={"hwType": "RTLSDR"}) - if r.status_code == 200: + if r.status_code / 100 == 2: print json.dumps(r.json(), indent=4, sort_keys=True) return True else: @@ -33,7 +33,7 @@ def selectRtlSdr(): def getRtlSdrSettings(): r = requests.get(url=base_url+"/deviceset/0/device/settings") - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() hwType = rj.get('deviceHwType', None) if hwType is not None and hwType == "RTLSDR": @@ -47,7 +47,7 @@ def getRtlSdrSettings(): def patchRtlSdrSettings(settings): new_settings = {"deviceHwType": "RTLSDR", "tx": 0, "rtlSdrSettings": settings} r = requests.patch(url=base_url+"/deviceset/0/device/settings", json=new_settings) - if r.status_code == 200: + if r.status_code / 100 == 2: print json.dumps(r.json(), indent=4, sort_keys=True) else: print "Error HTTP:", r.status_code @@ -57,7 +57,7 @@ def deviceRun(run): r = requests.post(url=base_url+"/deviceset/0/device/run") else: r = requests.delete(url=base_url+"/deviceset/0/device/run") - if r.status_code == 200: + if r.status_code / 100 == 2: print json.dumps(r.json(), indent=4, sort_keys=True) else: print "Error HTTP:", r.status_code diff --git a/swagger/sdrangel/examples/start_stop.py b/swagger/sdrangel/examples/start_stop.py index 801b129e7..6f266258a 100644 --- a/swagger/sdrangel/examples/start_stop.py +++ b/swagger/sdrangel/examples/start_stop.py @@ -36,7 +36,7 @@ def getInputOptions(): def startDevice(deviceIndex): dev_run_url = base_url+("/deviceset/%d/device/run" % deviceIndex) r = requests.get(url=dev_run_url) - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() state = rj.get("state", None) if state is not None: @@ -57,7 +57,7 @@ def startDevice(deviceIndex): def stopDevice(deviceIndex): dev_run_url = base_url+("/deviceset/%d/device/run" % deviceIndex) r = requests.get(url=dev_run_url) - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() state = rj.get("state", None) if state is not None: @@ -81,7 +81,7 @@ def main(): global base_url base_url = "http://%s/sdrangel" % options.address r = requests.get(url=base_url+"/devicesets") - if r.status_code == 200: + if r.status_code / 100 == 2: rj = r.json() deviceSets = rj.get("deviceSets", None) if deviceSets is not None: diff --git a/swagger/sdrangel/examples/stop_server.py b/swagger/sdrangel/examples/stop_server.py index 5ad408c6b..d7ff6d67a 100644 --- a/swagger/sdrangel/examples/stop_server.py +++ b/swagger/sdrangel/examples/stop_server.py @@ -40,7 +40,7 @@ def callAPI(url, method, params, json, text): request_method = requests_methods.get(method, None) if request_method is not None: r = request_method(url=base_url+url, params=params, json=json) - if r.status_code == 200: + if r.status_code / 100 == 2: print(text + " succeeded") printResponse(r) return r.json() # all 200 yield application/json response