HubDB update/replace table CSV upload help needed [php]



Can someone help me translate this into how a php curl would be? I’m unable to figure it out and just get 401 errors. I believe I’m doing it all wrong.

curl -v \
-F "file=@2017-05-01-FL.csv;type=text/csv" \
-F "config={
};type=application/json" \

Here is a a portion of the code I have below. The bottom function works to update the name of the table. That uses oauth2 just fine – I just have a problem forming this multipart post. I just can’t wrap my head around it:

PHP code - hubdb update api


If I change the header to:
curl_setopt($curl, CURLOPT_HTTPHEADER, [“Authorization: Bearer $accessToken”, “Content-type:multipart/form-data”]);
I get a 500 response
{“status”:“error”,“message”:“internal error”,“correlationId”:“cbd9226e-6c49-44f0-b70a-0ab0c9eda4cf”,“requestId”:“b8fe469f49431e95d690ec04efdf9c9d”}

I get this 500 response or a 415 response. I can’t seem to figure out anything else


Hi @nickdeckerdevs

We just updated the documentation with a PHP example:

The example uses a hapikey to keep the it simple, but you should be able to use an access token using the code you have in your last post before line 21 in the example:

@curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer $accessToken", "Content-type:multipart/form-data"]);


Thanks David, you are amazing!

Figured I would share my end result;

I’m using OAUTH so that the client can use this and not have to worry about api keys. That was a whole other fun thing.