Rawi

مرجع 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
domainstring | nullmax 190
replace_idinteger | 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*integerUnique ID.
name*string
domain*string | nullSite 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
codestring
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"
}'

امتحان در کنسول