مرجع API · Scans & reports
Add discovered brand to competitors
post
/competitors/discovered| احراز هویت | توکن مشتری (Bearer) |
|---|---|
| سطح دسترسی | کاربر رایگان · کاربر حرفهای Customer token (Bearer) — free and paid users |
Turns a discovered brand into a tracked competitor (source discovered); its past mentions are re-labelled as competitor mentions.
بدنه درخواست
| فیلد | نوع | توضیح |
|---|---|---|
name* | string | |
domain | string | null | max 190 |
replace_id | integer | null |
نمونهjson
{
"name": "حسابیار",
"domain": "hesabyar.example"
}
پاسخها
201 — Competitor The demo account already has 5 competitors, so this returns 422 «حداکثر ۵ رقیب» until one is removed in S1.
| فیلد | نوع | توضیح |
|---|---|---|
id* | integer | Unique ID. |
name* | string | |
domain* | string | null | Site domain. |
position* | integer | |
source* | string | |
replaced_id* | integer | null |
json
{
"id": 168,
"name": "حسابیار",
"domain": "hesabyar.example",
"position": 6,
"source": "discovered"
}
401 — Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): {"message":"…","code":"unauthenticated"} (message in the request language)
| فیلد | نوع |
|---|---|
message* | string |
code | string |
json
{
"message": "Please sign in to continue; your session has ended or is not valid.",
"code": "unauthenticated"
}
404 — No brand
| فیلد | نوع |
|---|---|
message* | string |
json
{
"message": ""
}
422 — Validation failed (name — already a competitor, or already 5 competitors)
| فیلد | نوع |
|---|---|
message* | string |
errors* | object |
json
{
"message": "",
"errors": {
"email": [
"ایمیل معتبر نیست."
]
}
}
نمونهٔ curl
bash
curl -X POST 'http://127.0.0.1:8010/api/competitors/discovered' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $RAWI_USER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"name": "حسابیار",
"domain": "hesabyar.example"
}'