- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Arquivos pdf podem ser adicionados ao pedido. Ele pode ser adicionado a um pedido existente ou então criado junto com o pedido.
Criar pedido com arquivo pdf
Exemplo com CURL:
curl -F "request[clinic_id]=19" \
-F "request[request_status_id]=53" \
-F "request[date]=2021-01-11T16:30" \
-F "request[dentist_datum][name]=João das Couves" \
-F "request[patient_datum][name]=Maria das Couves" \
-F "request[patient_datum][gender]=true" \
-F "request[patient_datum][birthdate]=1995-01-01" \
-F "request[archives_attributes][1][document]=@/path/arquivo.pdf" \
https://max.cfaz.net/api/v1/requests?access_token=0cd675768fev8dab81fe1c1297d56b09
Exemplo com Gem RestClient:
RestClient.post "https://max.cfaz.net/api/v1/requests",
{ request:
{ clinic_id: 19,
request_status_id: 53,
date: "2021-01-10T16:30",
dentist_datum: { name: "João das Couves" },
patient_datum: { name: "Maria das Couves", gender: true, birthdate: "1995-01-01"},
archives_attributes: [
{ "1": { document: File.open("/path/arquivo.pdf") }}
],
}
},
"authorization" => "Token token=0cd675768fev8dab81fe1c1297d56b09"
Adicionar arquivo pdf a um pedido existente
Exemplo com CURL:
curl -X PUT \
-F "request[archives_attributes][1][document]=@/path/arquivo.pdf" \
https://max.cfaz.net/api/v1/requests/{request_id}?access_token=0cd675768fev8dab81fe1c1297d56b09
Exemplo com Gem RestClient:
RestClient.put "https://max.cfaz.net/api/v1/requests/{request_id}",
{ request: {
archives_attributes: [
{ "1": { document: File.open("/path/arquivo.pdf") }}
],
}},
"authorization" => "Token token=0cd675768fev8dab81fe1c1297d56b09"
Excluir arquivo pdf de um pedido existente
Exemplo com CURL:
curl -X PUT \
-F "request[archives_attributes][1][id]={archive_id}" \
-F "request[archives_attributes][1][_destroy]=1" \
https://max.cfaz.net/api/v1/requests/{request_id}?access_token=0cd675768fev8dab81fe1c1297d56b09
Exemplo com Gem RestClient:
RestClient.put "https://max.cfaz.net/api/v1/requests/{request_id}",
{ request: {
id: {request.id},
archives_attributes: [
{ id: {archive.id}, _destroy: true }
],
}
},
"authorization" => "Token token=0cd675768fev8dab81fe1c1297d56b09"