Soap API: SetAssetMetadata fails to update values despite success response


(Eloy Villasclaras Fernandez) #1

Hello,

 

We're trying to automate some changes to our metadata but run into this issue. We use SOAP SetAssetMetadata to update a value:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ru="https:// ... ">
  <soap:Body>
    <ru:SetAssetMetadata>
      <AssetID>325724</AssetID>
      <FieldID>19501</FieldID>
      <NewValue>10,101,204</NewValue>
    </ru:SetAssetMetadata>
  </soap:Body>
</soap:Envelope>

Response is positive:

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https:// ... ">
  <SOAP-ENV:Body>
    <ns1:SetAssetMetadataResponse>
      <SetAssetMetadataResult>true</SetAssetMetadataResult>
    </ns1:SetAssetMetadataResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Error log does not seem to contain any entry related to the action, and the system log contains a line like:

[2016-07-22 09:19:56][298152: soap-user ][1024:matrix notice][ ] [asset.metadata.set.fulllog - assetid:325724;] (Asset Metadata Field Updated) - The metadata field "CUL.courses" of asset "1" was updated from "11" to "10,101,204"

However, after the action GetMetadataFieldValues returns the old value. Accessing the _admin interface of the updated asset, the metadata screen shows contradictory information:

  • At the top, in the XML-like data view, the old value is shown.
  • At the bottom, in the human-readable view (with or without locks, either in read-only text or in the input field), it displays the new value.

 

In that metadata screen, if we acquire locks and commit immediately (without touching any input field), the new value is saved correctly and is displayed at the top of the view. The system log contains a new line for the same field, but with the same old/new values:

The metadata field "CUL.courses" of asset "1" was updated from "11" to "10,101,204"

The user authenticated in the SOAP request has admin and write access to the asset; the schema is live; the asset itself is under construction.

 

Any idea what we may be doing wrong?

 

Thank you,

Eloy

 

 

 


(Eloy Villasclaras Fernandez) #2

I forgot to mention: our Matrix version is 5.3.2.1.

Also, other SOAP methods (set asset status, set asset paths) are working fine.

 

Eloy


(Peter McLeod) #3

Hi
Not sure if it will make a difference, but maybe try regenerating the metadata schema as a first step.

https://matrix-manuals.squiz.net/metadata-schemas/chapters/regenerating-a-metadata-schema

Thanks

Peter


(Eloy Villasclaras Fernandez) #4

Hi Not sure if it will make a difference, but maybe try regenerating the metadata schema as a first step.
https://matrix-manuals.squiz.net/metadata-schemas/chapters/regenerating-a-metadata-schema
Thanks
Peter

 

Hi, thank you for the suggestion.

 

To test this I created a new schema, applied it and tried again. The problem remains the same, both after just applying the schema, and after regenerating it: the metadata view in the admin interface shows different values, and GetMetadataFieldValues returns the old value.

 

However, after executing SetAssetMetadata, AND THEN regenerating the metadata, the new value took effect. I've noticed that regenerating the metadata is an option in the SOAP api, but this is not a solution for us as it'd be a very long operation for some schemas.

 

Is there any operation that would trigger a "resave" of the asset metadata (but affecting only one asset)?

Eloy


(Eloy Villasclaras Fernandez) #5

 

Is there any operation that would trigger a "resave" of the asset metadata (but affecting only one asset)?

 

 

Well, my bad.

 

Actually RegenerateMetadataAsset does exactly that. To update the metadata I just need to first run SetAssetMetadata and then RegenerateMetadataAsset.

Thank you Peter for pointing in the right direction!!! :)

 

Eloy