redguava / cliniko-api

The API for Cliniko
73 stars 39 forks source link

CORS error when trying to attach files using patient_attachments #347

Closed amahta closed 3 years ago

amahta commented 3 years ago

I'm trying to attach a file to a patient using the following endpoint: https://api.au1.cliniko.com/v1/patient_attachments

I get this response:

{
    "errors": {
        "temp_attachment_url": "is invalid"
    },
    "message": "Validation Failed"
}

Response code is 422

Here are a few response headers that might be useful:\

X-Cache = Error from cloudfront
X-Permitted-Cross-Domain-Policies = none
X-Frame-Options = SAMEORIGIN
X-Download-Options = noopen
X-Content-Type-Options = nosniff
Referrer-Policy = strict-origin-when-cross-origin

Any ideas?

JohnColvin commented 3 years ago

Hey Amin,

Are you following this guide for uploading attachments? https://github.com/redguava/cliniko-api/blob/main/guides/uploading_patient_attachments.md

You have to get a presigned post from s3, upload the file to our bucket, and then POST to the patient_attachments route.

amahta commented 3 years ago

Thanks @JohnColvin, that seems like the answer for me.

Two points that I think will be quite helpful for future generations: