Create a customer
Any signed in user. Registers a customer and returns the row as the register will read it. Only name is required, and a negative credit limit is refused with 400 before any write.
POST
/api/v1/customersAuthorization
AuthorizationBearer token (JWT) · headerrequiredJWT from POST /api/v1/auth/login sent as Authorization Bearer.
Request body
requiredapplication/jsonnamestringrequiredmin length 1
phonestringdefault: ""
national_idstringdefault: ""
notesstringdefault: ""
credit_limitnumbermin 0 · default: 0
is_credit_allowedbooleandefault: false
Responses
201
Customer registered
idstringrequirednamestringrequiredphonestringrequirednational_idstringrequirednotesstringrequiredimage_urlstringrequiredcredit_limitstringrequiredcurrent_balancestringrequiredis_credit_allowedbooleanrequiredcreated_atstringrequiredupdated_atstringrequiredis_deletedbooleanrequired400
The name is empty or a field fails validation, such as a negative credit limit
detailstringrequired401
Not authenticated
detailstringrequired