Rawi

API reference · Questions

Replace question («پرسش دیگر»)

post/questions/{id}/replace
AuthenticationCustomer token (Bearer)
AccessFree user · Pro user

Customer token (Bearer) — free and paid users

Swaps the question for the next unused template of the same stage/type/cell.

Parameters

NameInTypeDescription
id*pathintegerPostman variable {{questionId}}

Responses

200 — Question

FieldTypeDescription
id*integerUnique ID.
stage*stringBuying stage of the question.
type*string
text*string
language*string
cell_id*integer | nullthe question's own language: lang/dir on its text (as in the reports)
position*integer
edited*boolean
json
{
  "id": 0,
  "stage": "",
  "type": "",
  "text": "",
  "language": "",
  "cell_id": 0,
  "position": 0,
  "edited": false
}

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)

FieldType
message*string
codestring
json
{
  "message": "Please sign in to continue; your session has ended or is not valid.",
  "code": "unauthenticated"
}

403 — plan_limit — no changes left

FieldType
message*string
code*string ("plan_limit", "forbidden")
json
{
  "message": "این امکان در طرح راوی حرفه‌ای است.",
  "code": "plan_limit"
}

404 — Unknown id (or not owned by the caller)

FieldType
message*string
json
{
  "message": ""
}

422 — Validation failed (question — no alternative template left)

FieldType
message*string
errors*object
json
{
  "message": "",
  "errors": {
    "email": [
      "ایمیل معتبر نیست."
    ]
  }
}

curl example

bash
curl -X POST 'http://127.0.0.1:8010/api/questions/{id}/replace' \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $RAWI_USER_TOKEN"

Try it in the console