This is the data that’s being set for the new Asset to assign the file against it. Data is a passed object where data.id is the response.sys.id of the upload response of the file. Response to this is success.
I tried this, however each time it came back with an error when trying to add the asset after a successful response for uploading the image.
BadRequest : Invalid JSON in request body: ����\u0000\u0010JFIF\u0000\u0001....
However when using base64 the error does not exist. And hence, I was creating the asset, now it doesn’t. It worked also when adding a remote image to the asset. It’s only when binary is used it fails. Hence why I was using base64.
You can’t put a binary file into the create asset request directly. You need to upload the file to upload.contentful.com as shown the in code snippet above then take the response which has an upload ID and use it when making the create asset request. The main steps are:
That is exactly what I am doing! It was your response that you edited that mentioned the processing of the resource. Which is why I mentioned that I’m following the documentation as it does not state processing of the resource.
For this public forum it would be helpful if you could share the code you are using so we can help you fix the problem. If you don’t want to share publicly that’s completely fine but our support team will also ask to see your code.
I will say following those steps, it’s not very clear about how one publishes an asset after processing it, if you’re not using the supplied SDK. It’s clearly not as simple as the 1, 2, 3, 4, as stated.
Does one have to continually poll the server to see if the asset has been processed? What determines that the asset has been processed, as looking at the JSON response of getting an asset there nothing in that to determine it.
Normally asset processing happens very quickly, but it is asynchronous so it doesn’t happen immediately. What the SDKs and other tooling we’ve developed does behind the scenes is to poll the API for the asset until the response has a fields.file[locale].url key and value. That is the best indicator that the file has completed processing.