Image upload using Guzzle

in Development
I'm struggling to upload images. I'm getting 500 internal server errors so I'm assuming I'm sending malformed requests.
This is all I've managed to come up with:
$itemResponse = $this->lightspeedClient->post('Item/' . $itemID . '/Image.json', [ 'json' => [ "description" => $itemID, "ordering" => 0 ], 'multipart' => [ [ 'name' => "image", 'contents' => $contents, ] ] ]);
Could anyone point me in the right direction? I know my snippet is a little vague. Could anyone post an example of uploading an image using guzzle?
1 comment
I eventually solved this. In case anyone else is curious, multipart cannot be used with json using Guzzle.
http://docs.guzzlephp.org/en/stable/request-options.html#multipart
Something like this is what worked for me: