Hey velo forum
Got this is annoying me like crazy. got this curl Data that ive tested and it works
-H "Content-Type:application/json" \
-d '{
"procedures": [
{
"code_id": "100015000000006112",
"item_charge": "100.0",
"item_quantity": "1",
"modifier_1": "25",
"modifier_2": "FH",
"modifier_3": "",
"modifier_4": "",
"place_of_service": "02",
"related_diagnosis_ids": [
"100015000000009021"
]
},
{
"code_id": "100015000000006124",
"item_charge": "100.0",
"item_quantity": "1",
"modifier_1": "25",
"modifier_2": "FH",
"modifier_3": "",
"modifier_4": "",
"place_of_service": "02",
"related_diagnosis_ids": [
"100015000000009021"
]
}
]
}'
Now i rewrote it to work in a fetch on wix, as ive done bunch of times before, but i must be missing something cause i keep getting bad request.
var data = {
"procedures": [
{
"code_id": "100015000000006112",
"item_charge": "100.0",
"item_quantity": "1",
"modifier_1": "25",
"modifier_2": "FH",
"modifier_3": "",
"modifier_4": "",
"place_of_service": "02",
"related_diagnosis_ids": [
"100015000000009021"
]
},
{
"code_id": "100015000000006124",
"item_charge": "100.0",
"item_quantity": "1",
"modifier_1": "25",
"modifier_2": "FH",
"modifier_3": "",
"modifier_4": "",
"place_of_service": "02",
"related_diagnosis_ids": [
"100015000000009021"
]
}
]
};
Hoping someone can see the difference in the two data values that ive forgotten to change ![]()
Here is the fetch request (stripped of data) if that might be of help
let newProcedure = await fetch("https://sandbox2.charmtracker.com/api/ehr/v1/patients/" + patientID + "/encounters/" + encounterID + "/procedures", {
body: JSON.stringify(data),
//body: {data},
headers: {
Api_key: "myAPIKeyhere",
Authorization: "Bearer " + await checkToken(),
//"Cache-Control": "no-cache",
"Content-Type": "application/json"
},
method: "POST"
})
.then((httpResponse) => {
console.log("Raw response: ", httpResponse);
if (httpResponse.ok) {
return httpResponse.json();
} else {
return Promise.reject("Fetch did not succeed");
}
})
Thank you in advance.