The Holibob API - Uploading file to booking question of type `file`
Below is the interim solution to support file upload for a booking. There is a specific question type of FILE
that needs to be available on the product to support this functionality.
Ensure you have question of type
file
created via HolibobFollow standard booking flow until you reach the questions for the booking
Execute the
/getBookingUploadUrl
mutation to retrieve a signed url to which you can upload a file (mutation has to be run for each booking question of typefile
)
Note that you need to providebookingId
andbookingQuestionId
GRAPHQLmutation getBookingUploadUrl($bookingId: ID!, $bookingQuestionId: ID!) { bookingQuestionUpload(bookingId: $bookingId, bookingQuestionId: $bookingQuestionId, contentType: "application/pdf") { uploadUrl } }
Upload a file by sending PUT request to
uploadUrl
. Examples with HTTP:PDF Example
BASHhttp PUT '[uploadUrlGoesHere]' \ Content-Type:application/pdf \ x-amz-acl:private < file.pdf
Image Example
BASHhttp PUT '[uploadUrlGoesHere]' \ Content-Type:image/jpeg \ x-amz-acl:private < image.jpeg
Answer the booking question with value of "true" and follow the standard flow to commit the booking
Example answer below:JSON{ "questionId": "826f12ad-363a-40c4-a1e5-9856302dd342", "value": "true" }
Once answer value is set to
true
you can queryanswerFile
field to receive path to the fileGRAPHQLquery useBooking($id: String!, $input: BookingInput) { booking(id: $id, input: $input) { questionList { nodes { id answerFile # url to file answerValue answerFormattedText } } } }
Maximum file size is 10MB