I really love cockpit, but I didn’t find any option to upload images via API. That’s why, I made one with cloudinary.
The process is like - upload image to Cloudinary and attach the image URL to Cockpit collection.
I know this is not a very good option to skip the whole cockpit assets manager but it does help me for my project.
Could one of you give a try and feedback me?, thanks in advance.
Hey @ronaldaug, not sure by what you mean “any option to upload images via API”… because that is possible, e.g.:
You can upload one or more assets using the /api/cockpit/addAssets
endpoint, ensure you are posting as multipart.
uh… I didn’t know addAssets exits, Thanks for this.
I wish cockpit has more contributors for the documentation.
Hi @pauloamgomes ,
(Let me just ask here again)
Let’s say I have a signup form and want new visitors to register,
How do I let them register via API? ( Probably, it won’t include token key )
I have checked on the documentation page, but it needs to provide at least a token key to create new user.
Thanks.
That’s correct, you need it, but you can create an API token only for that endpoint, e.g.:
/api/cockpit/authUser*
1 Like
Thanks for the info on addAssets first off. It’s been tough finding information, the docs really need some love.
@pauloamgomes Perhaps you can point me in the right direction here, cause I’m running into an issue where the response for addAssets is 200 but all I get are three empty arrays for uploaded, failed and assets.
Path is good, content-type set to multipart/form-data, but not getting anything returned or in the server logs to indicate something wrong is happening.
Long story short, I’m trying to wire up a form that can allow a user to upload an image that can be referenced in the results in the Cockpit admin side.
@JoshuaJones Does it work if you name the key files[]
instead of files
?
And please open a new thread the next time. It’s better to have multiple, short and solved issues with a clear title instead of one long thread with multiple topics.
1 Like
It does not. That said, I’ll go ahead and open up a new thread per your feedback, thanks!