421 lines
11 KiB
JSON
421 lines
11 KiB
JSON
{
|
|
"info": {
|
|
"_postman_id": "a5404a90-7d5a-4e9f-a26b-bb2bc93f19a2",
|
|
"name": "hushyar",
|
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
"_exporter_id": "12336342",
|
|
"_collection_link": "https://abbas-rahimzadeh-postman.postman.co/workspace/public-workspace~57c702f9-fed1-4b27-b507-0b0252812bf7/collection/12336342-a5404a90-7d5a-4e9f-a26b-bb2bc93f19a2?action=share&source=collection_link&creator=12336342"
|
|
},
|
|
"item": [
|
|
{
|
|
"name": "v1",
|
|
"item": [
|
|
{
|
|
"name": "organization",
|
|
"item": [
|
|
{
|
|
"name": "register-user",
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "X-API-Key",
|
|
"value": "{{organizationApiKey}}",
|
|
"description": "Organization API Key",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"09123456789\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
},
|
|
"description": "Register a new user or get existing user via organization API key. If user is new or has no organization, they will be assigned to this organization and their wallet will be charged with the organization's user_credit."
|
|
},
|
|
"response": [
|
|
{
|
|
"name": "success - new user",
|
|
"originalRequest": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "X-API-Key",
|
|
"value": "{{organizationApiKey}}",
|
|
"description": "Organization API Key",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"09123456789\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
}
|
|
},
|
|
"status": "OK",
|
|
"code": 200,
|
|
"_postman_previewlanguage": "json",
|
|
"header": [
|
|
{
|
|
"key": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"cookie": [],
|
|
"body": "{\n \"id\": 1,\n \"mobile_number\": \"09123456789\",\n \"organization_id\": 1,\n \"organization_title\": \"Test Organization\",\n \"wallet_balance\": 100.0,\n \"is_new_user\": true,\n \"credit_charged\": 100.0\n}"
|
|
},
|
|
{
|
|
"name": "success - existing user",
|
|
"originalRequest": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "X-API-Key",
|
|
"value": "{{organizationApiKey}}",
|
|
"description": "Organization API Key",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"09123456789\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
}
|
|
},
|
|
"status": "OK",
|
|
"code": 200,
|
|
"_postman_previewlanguage": "json",
|
|
"header": [
|
|
{
|
|
"key": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"cookie": [],
|
|
"body": "{\n \"id\": 1,\n \"mobile_number\": \"09123456789\",\n \"organization_id\": 1,\n \"organization_title\": \"Test Organization\",\n \"wallet_balance\": 100.0,\n \"is_new_user\": false,\n \"credit_charged\": 0.0\n}"
|
|
},
|
|
{
|
|
"name": "invalid api key",
|
|
"originalRequest": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "X-API-Key",
|
|
"value": "invalid-api-key",
|
|
"description": "Organization API Key",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"09123456789\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
}
|
|
},
|
|
"status": "Unauthorized",
|
|
"code": 401,
|
|
"_postman_previewlanguage": "json",
|
|
"header": [
|
|
{
|
|
"key": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"cookie": [],
|
|
"body": "{\n \"error_code\": \"INVALID_API_KEY\",\n \"message\": \"Invalid API key\",\n \"context\": {\n \"api_key_prefix\": \"invalid-\"\n }\n}"
|
|
},
|
|
{
|
|
"name": "organization disabled",
|
|
"originalRequest": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "X-API-Key",
|
|
"value": "{{organizationApiKey}}",
|
|
"description": "Organization API Key",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"09123456789\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
}
|
|
},
|
|
"status": "Forbidden",
|
|
"code": 403,
|
|
"_postman_previewlanguage": "json",
|
|
"header": [
|
|
{
|
|
"key": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"cookie": [],
|
|
"body": "{\n \"error_code\": \"ORGANIZATION_DISABLED\",\n \"message\": \"Organization is disabled\",\n \"context\": {\n \"organization_id\": 1\n }\n}"
|
|
},
|
|
{
|
|
"name": "organization expired",
|
|
"originalRequest": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "X-API-Key",
|
|
"value": "{{organizationApiKey}}",
|
|
"description": "Organization API Key",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"09123456789\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
}
|
|
},
|
|
"status": "Forbidden",
|
|
"code": 403,
|
|
"_postman_previewlanguage": "json",
|
|
"header": [
|
|
{
|
|
"key": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"cookie": [],
|
|
"body": "{\n \"error_code\": \"ORGANIZATION_EXPIRED\",\n \"message\": \"Organization has expired\",\n \"context\": {\n \"organization_id\": 1,\n \"expires_at\": \"2024-01-01T00:00:00\"\n }\n}"
|
|
},
|
|
{
|
|
"name": "invalid mobile format",
|
|
"originalRequest": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "X-API-Key",
|
|
"value": "{{organizationApiKey}}",
|
|
"description": "Organization API Key",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"01234567890\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
}
|
|
},
|
|
"status": "Unprocessable Entity",
|
|
"code": 422,
|
|
"_postman_previewlanguage": "json",
|
|
"header": [
|
|
{
|
|
"key": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"cookie": [],
|
|
"body": "{\n \"mobile_number\": \"String should match pattern '^09\\\\d{9}$'\"\n}"
|
|
},
|
|
{
|
|
"name": "missing api key header",
|
|
"originalRequest": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"mobile_number\": \"09123456789\"\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{baseURL}}/api/v1/organizations/register-user",
|
|
"host": [
|
|
"{{baseURL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"organizations",
|
|
"register-user"
|
|
]
|
|
}
|
|
},
|
|
"status": "Unprocessable Entity",
|
|
"code": 422,
|
|
"_postman_previewlanguage": "json",
|
|
"header": [
|
|
{
|
|
"key": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"cookie": [],
|
|
"body": "{\n \"detail\": [\n {\n \"type\": \"missing\",\n \"loc\": [\"header\", \"x-api-key\"],\n \"msg\": \"Field required\",\n \"input\": null\n }\n ]\n}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"event": [
|
|
{
|
|
"listen": "prerequest",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"packages": {},
|
|
"exec": [
|
|
""
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"packages": {},
|
|
"exec": [
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"variable": [
|
|
{
|
|
"key": "baseURL",
|
|
"value": "http://127.0.0.0:8000",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"key": "access_token",
|
|
"value": "",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"key": "accessToken",
|
|
"value": ""
|
|
},
|
|
{
|
|
"key": "refreshToken",
|
|
"value": ""
|
|
},
|
|
{
|
|
"key": "organizationApiKey",
|
|
"value": "",
|
|
"type": "string"
|
|
}
|
|
]
|
|
} |