I am still looking for a solution to a problem we are having with some of our renders. Basically, some various renders are not coming out well enough to suit our organization. So, our potential solution would involve downloading a single render layer .png, putting it in a photo editor to touch it up with the necessary edits, then re-uploading the resulting .png in place of the original. I’ve previously been told that this is theoretically possible using a combination of the API’s. I believe I have found the method in which we would upload the edited image, but I can not find any method that would allow us to download the original image.
It sounds like you should start with the Layers Service.
You can get layers associated to an item or a configuration (Get List of Layers). Keep in mind assetLayerConfiguration must be passed as encoding stringified JSON.
This would return an array of objects, the layers. Each entry will have a fileId parameter which you can use to download the layer. It will be accessible at https://{ENV}.threekit.com/api/files/{FILE_ID}/content
You can then POST the touched up layer to the Files Service, which will store it in the platform. You can associate that file to a new layer with the Create a Layer API. As far as I know, you cannot update existing layers, you’ll have to create a new one.
If you need some additional guidance or examples, please let me know. Andrei will likely have some code snippets or we can cook one up for you.
I believe that files URL may be the answer that completes the puzzle for me. Thanks. If this gets me to a solution I will put it in this thread & the other one.
I agree this particular workflow isn’t documented currently. I will see about solving this.
Please recall the note I made about the cropping that we apply to the individual layer renders.
@Will@AndreiSE Is there a way to delete a layer? I’m happy to recreate the layer via the API, but without being able to delete the layer that was previously there, wouldn’t we have two layers with duplicate stage & item configuration?
You can’t delete layers, because we can’t delete renders from the database. Everything is retained so it doesn’t get lost by mistake.
Simply create a new layer. There shouldn’t be any conflicts. It’s probably easiest to get the info from the previous layer first, and then pass it to the new create layer call.
The new entry will simply override the existing entry.
Oh, and yes, creating a new layer will indeed generate a new layerId, which is the only downside of this process that I can see.
@AndreiSE@Will I have now successfully created the new layers with what seems to be the correct configuration. Is there some time period I have to wait before I see the results reflected in the configurator or something?
Or is there an extra set of steps that I have to do to associate the new layerId?
There shouldn’t be a need for additional steps.
We need to run some tests at our end as well to verify all options, but unfortunately this week we are all engaged with a series of company events. I will see if I can get more input from the engineering team tomorrow, but we might not be able to run any testing and debugging until Monday.
The only thing that comes to mind at the moment is that depending on how you are testing the player and your setup, you will need to republish the item where you posted the renders.
Publishing items refreshes the cache key. If you are testing an embedded player with published items then you are only receiving the existing cached renders from the previous version of the layer. Simply republishing the item will refresh the cache key, but you need to wait for the thumbnail job to finish before you test again.
I have only been looking at it in the Threekit platform on the player that is available on the Item details screen & the Renders screen. I can see the thumbnail of the new image on the render entry.
We haven’t seen any issues yet.
Are you sure you passed both the asset and stage configuration correctly to the new layer?
If you are using a stage, it is important to also pass the stageId along with the stageConfiguration.
If you want us to have a look at your code, please feel free to email it to me at [email protected].
@UrbanElectricAlex
I ran some tests myself, and after comparing with the docs, it appears that the docs are missing a few required parameters.
In your case where you are working with composite assets, you need to pass the assetLayer parameter to the body, with the layerId.
In addition to that, you also need to include the width and height parameters, in addition to the metadata that includes the offsets and crop.
This is all info you have available in the GetLayer By ID or by Query Parameters return as well.
I will get the CreateLayer API updated in the docs to list those additional parameters.
Here is an example of the JSON that I could pass to the request body, for a layer without configuration.
@AndreiSE
Here’s an example of the request I’m sending to the create layer API. I’m seeing the layer get created just fine with the thumbnail of my edited image. But the configurator doesn’t show it.
@AndreiSE
Here’s my new JSON after implementing your feedback. I see in the docs that it’s calling assetVersion a required field. Currently, I’m just passing that as an empty string because I’m not sure where to get that from. Could that be my issue?