Skip to content

Commit

Permalink
fix(wizard-api): return null with 200 instead of 404 for unconfigured…
Browse files Browse the repository at this point in the history
… items (#361)

Updated the following endpoints to return null and HTTP status 200 when no configured items are found:
- GET /mobiles/{mainextension}
- GET /mobileapp/{mainextension}
- GET /nethlink/{mainextension}
- GET /webrtc/{mainextension}
- GET /voicemails/{extension}

NethServer/dev#7259
  • Loading branch information
Stell0 authored Jan 30, 2025
1 parent ec6dae3 commit a1a64d0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion freepbx/var/www/html/freepbx/rest/modules/mobiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
' WHERE userman_users.username = \''. $username. '\'';
$mobile = $dbh->sql($sql, 'getOne', \PDO::FETCH_ASSOC);
if ($mobile == false) {
return $response->withStatus(404);
return $response->withJson(null,200);
}

return $response->withJson($mobile, 200);
Expand Down
2 changes: 1 addition & 1 deletion freepbx/var/www/html/freepbx/rest/modules/nethlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
if (!empty($extension)) {
return $response->withJson($extension, 200);
} else {
return $response->withStatus(404);
return $response->withJson(null,200);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
if (!empty($extension)) {
return $response->withJson($extension, 200);
} else {
return $response->withStatus(404);
return $response->withJson(null,200);
}
});

Expand Down
2 changes: 1 addition & 1 deletion freepbx/var/www/html/freepbx/rest/modules/voicemails.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
$res = FreePBX::Voicemail()->getVoicemail();

if (is_array($res['default']) && !array_key_exists($extension, $res['default'])) {
return $response->withStatus(404);
return $response->withJson(null,200);
}

return $response->withJson($res['default'][$extension], 200);
Expand Down
2 changes: 1 addition & 1 deletion freepbx/var/www/html/freepbx/rest/modules/webrtc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
if (!empty($extension)) {
return $response->withJson($extension, 200);
} else {
return $response->withStatus(404);
return $response->withJson(null,200);
}
});

Expand Down

0 comments on commit a1a64d0

Please sign in to comment.