Closed romanm closed 6 years ago
Добрый день. json, который Вы отправляете, не проходит несколько проверок. В частности в ответе, помимо кода, также указываются не верно заполненные поля. Например, у Вас отсутствуют поля доктора, некоторые из которых являются обязательными; не верный формат дат и email'а. Полный код ошибки:
{
"meta": {
"url": "http://api-svc.il/api/employee_requests",
"type": "object",
"request_id": "48236d08-d692-4d7a-851e-45bb7ecbb799#131582",
"code": 422
},
"error": {
"type": "validation_failed",
"message": "Validation failed. You can find validators description at our API Manifest: http://docs.apimanifest.apiary.io/#introduction/interacting-with-api/errors.",
"invalid": [
{
"rules": [
{
"rule": "required",
"params": [],
"description": "required property educations was not present"
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.doctor.educations"
},
{
"rules": [
{
"rule": "required",
"params": [],
"description": "required property specialities was not present"
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.doctor.specialities"
},
{
"rules": [
{
"rule": "format",
"params": [
"^(\\d{4}(?!\\d{2}\\b))((-)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6]))))$"
],
"description": "string does not match pattern \"^(\\\\d{4}(?!\\\\d{2}\\\\b))((-)((0[1-9]|1[0-2])(\\\\3([12]\\\\d|0[1-9]|3[01]))|(00[1-9]|0[1-9]\\\\d|[12]\\\\d{2}|3([0-5]\\\\d|6[1-6]))))$\""
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.end_date"
},
{
"rules": [
{
"rule": "email",
"params": [
"~r/^[\\w!#$%&'*+\\/=?`{|}~^-]+(?:\\.[\\w!#$%&'*+\\/=?`{|}~^-]+)*@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}$/i"
],
"description": "expected \"x@y.z\" to be an email address"
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.party.email"
},
{
"rules": [
{
"rule": "format",
"params": [
"^[А-Яа-яёЁЇїІіЄєҐґ]+$"
],
"description": "string does not match pattern \"^[А-Яа-яёЁЇїІіЄєҐґ]+$\""
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.party.second_name"
},
{
"rules": [
{
"rule": "required",
"params": [],
"description": "required property birth_date was not present"
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.party.birth_date"
},
{
"rules": [
{
"rule": "required",
"params": [],
"description": "required property tax_id was not present"
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.party.tax_id"
},
{
"rules": [
{
"rule": "required",
"params": [],
"description": "required property phones was not present"
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.party.phones"
},
{
"rules": [
{
"rule": "format",
"params": [
"^(\\d{4}(?!\\d{2}\\b))((-)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6]))))$"
],
"description": "string does not match pattern \"^(\\\\d{4}(?!\\\\d{2}\\\\b))((-)((0[1-9]|1[0-2])(\\\\3([12]\\\\d|0[1-9]|3[01]))|(00[1-9]|0[1-9]\\\\d|[12]\\\\d{2}|3([0-5]\\\\d|6[1-6]))))$\""
}
],
"entry_type": "json_data_property",
"entry": "$.employee_request.start_date"
}
]
}
}
Дякую } catch (HttpClientErrorException ce) { рішає проблему тепер повертається очікуваний JSON повний error для обробки issue можна закрити
Доброго дня, Прохання перевірити і підсказати в чому проблема.
Приходить HTTP error 422 Unprocessable Entity при спробі employee registry in eHealth
https://api.ehealth.world/api/employee_requests Заголовок: {Content-Type=[application/json], api-key=[cf8ddbe190a54e153bf9], Authorization=[Bearer RVkzSW14eFJOWk96STU1YjU5NTRMUT09]} Данні що відсилаються: https://github.com/romanm/algoritmed-mvp1-ehealth/blob/master/src/main/resources/static/f/js/x2.json також перепровірено з повними даними згідно прикладу в документації https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/employee-requests/create-employee-request
Більш детальні подробиці в відповідному комітменті: https://github.com/romanm/algoritmed-mvp1-ehealth/commit/fda1c07e96185835a4ba7a3eaac2247e6084031a
Дякую, Роман.