Skip to content

Commit

Permalink
Merge pull request #5482 from mailcow/feat/get-spam-score
Browse files Browse the repository at this point in the history
[Web] add /api/v1/get/spam-score endpoint
  • Loading branch information
FreddleSpl0it authored Nov 24, 2023
2 parents 5619e16 + 3b18393 commit f994501
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
34 changes: 34 additions & 0 deletions data/web/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5646,6 +5646,40 @@ paths:
items:
type: string
summary: Edit Cross-Origin Resource Sharing (CORS) settings
"/api/v1/get/spam-score/{mailbox}":
get:
parameters:
- description: name of mailbox or empty for current user - admin user will retrieve the global spam filter score
in: path
name: mailbox
required: true
schema:
type: string
- description: e.g. api-key-string
example: api-key-string
in: header
name: X-API-Key
required: false
schema:
type: string
responses:
"401":
$ref: "#/components/responses/Unauthorized"
"200":
content:
application/json:
examples:
response:
value:
spam_score: "8,15"
description: OK
headers: {}
tags:
- Mailboxes
description: >-
Using this endpoint you can get the global spam filter score or the spam filter score of a certain mailbox.
operationId: Get mailbox or global spam filter score
summary: Get mailbox or global spam filter score

tags:
- name: Domains
Expand Down
6 changes: 6 additions & 0 deletions data/web/json_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,12 @@ function process_get_return($data, $object = true) {
}
}
break;
case "spam-score":
$score = mailbox('get', 'spam_score', $object);
if ($score)
$score = array("score" => preg_replace("/\s+/", "", $score));
process_get_return($score);
break;
break;
// return no route found if no case is matched
default:
Expand Down

0 comments on commit f994501

Please sign in to comment.