2blane / OctoPrint-Webhooks

Make OctoPrint events call your custom webhooks!
GNU Affero General Public License v3.0
28 stars 19 forks source link

Json format #12

Closed mrobotmaker closed 4 years ago

mrobotmaker commented 4 years ago

hello, I'm trying to extract data from Json. But when I return the data receive from POST on my server I have thing like that: Response: --248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="deviceIdentifier"printer1--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="extra"{"origin": "local", "popup": true, "name": "example.gcode", "hook_index": 0, "time": 50.237335886, "owner": "example_user", "path": "example.gcode", "size": 242038}--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="job"{"file": {"date": null, "origin": null, "size": null, "name": null, "path": null}, "estimatedPrintTime": null, "user": null, "filament": {"volume": null, "length": null}, "lastPrintTime": null}--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="offsets"{}--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="apiSecret"pfkpfjrg--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="topic"Print Started--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="state"{"text": "Operational", "flags": {"cancelling": false, "paused": false, "operational": true, "pausing": false, "printing": false, "resuming": false, "sdReady": true, "error": false, "ready": true, "finishing": false, "closedOrError": false}}--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="meta"--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="currentTime"1593513960--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="progress"{"completion": null, "filepos": null, "printTime": null, "printTimeLeft": null, "printTimeOrigin": null}--248f0bf5eadc4780acfc88d7a82b61e0Content-Disposition: form-data; name="message"Your print has started--248f0bf5eadc4780acfc88d7a82b61e0-- I try with out the pluging to validate the server answer and I get json back, so I don't where is the trouble in my plugin configuration

2blane commented 4 years ago

See this answer. Basically, if you have the image snapshot enabled, then we can only send multipart-form data. We can't send an image through JSON.

6