The LiquidPlanner Developer Hub

Welcome to the LiquidPlanner developer hub. You'll find comprehensive guides and documentation to help you start working with LiquidPlanner as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    
Ask A Question



Upload Documents via API

Hello, I'm having issues uploading files up to Liquid Planner through the use of the API. In an effort to solve this, I even created a simple form that uploads a data file to a temporary file then attempts the upload by calling the API. So far I found a complete example that should work provided in this form but still seem to not be having any luck. Code Snip it: // $url = "" . $workspaceID . "/tasks/" . $taskId . "/documents"; $file = realpath($fileLocation); $data = array( "document[file_name]" => $fileName, "document[description]" => $fileDesc, "document[attached_file]" => "@".$fileLocation, ); var_dump($data); $conn = curl_init(); curl_setopt($conn, CURLOPT_HEADER, 0); curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1); curl_setopt($conn, CURLOPT_ENCODING, ""); curl_setopt($conn, CURLOPT_USERPWD, $email . ":" . $password ); curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($conn, CURLOPT_POST, true); curl_setopt($conn, CURLOPT_URL, $url); curl_setopt($conn, CURLOPT_POSTFIELDS, $data); $response = curl_exec($conn); print_r( $response."\n" ); curl_close($conn); This is what var_dump is reporting: C:\wamp64\www\EIS\LP_Success.php:88: array (size=3) 'document[file_name]' => string 'ckt2.pdf' (length=8) 'document[description]' => string 'application/pdf' (length=15) 'document[attached_file]' => string '@C:\wamp64\www\EIS\uploads\ckt2.pdf' (length=35) {"type":"Error","error":"BadArgument","message":"You must POST a document[attached_file] part when creating a document."} I even went as far as to create a submit form coupled with a process file form to try to get this to work outside of my PHP App. If you would like me to send you the full source which is 2 files I'll be happy to do so. Thanks Miguel Grajeda


Posted by Miguel Grajeda 11 months ago