update asset metadata exception : The request could not be understood due to malformed syntax.

Hi Team,

When I try update asset metadata field using Rest API(PATCH Method) it throughs exception like

"The request could not be understood due to malformed syntax". Is it an issue with Syntax?

Test Sample :

Method : PATCH

uri : https://<ServURL>/otmmapi/v6/assets/id?lock_strategy=optimistic

Body :

Field Details :

I am not sure what could be the issue here.

logs shows

https-jsse-nio-443-exec-9 2024-04-05T10:32:17,046 | ERROR | session= | user= | com.opentext.mediamanager.restapi.exceptions.mappers.BaseExceptionMapper | CSRF attack detected
com.opentext.mediamanager.restapi.exceptions.OTMMRestException: The request could not be understood due to malformed syntax.
at com.opentext.mediamanager.restapi.exceptions.mappers.BadRequestExceptionMapper.toResponse(BadRequestExceptionMapper.java:23)
at com.opentext.mediamanager.restapi.exceptions.mappers.BadRequestExceptionMapper.toResponse(BadRequestExceptionMapper.java:13)
at org.glassfish.jersey.server.ServerRuntime$Responder.mapException(ServerRuntime.java:528)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:405)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:263)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)

Please correct me if any.

Thanks

Apparao

Answers

  • Hi Apparao,

    I presume you created a session first ad have that in your Headers?

    In your REST call: "uri : https://<ServURL>/otmmapi/v6/assets/id?lock_strategy=optimistic", do you have the actual asset ID in place where you have id? (that may be a v5 format)

    This is what I have for an update in a v5 call (using Postman):

    swAsswtId is a variable holding the asset ID

    swAssetName is a variable holding the string to put in the "ARTESIA.FIELD.ASSET NAME" field

    If v6 is to have "id" as a parameter value in the URL, then I would imagine that where you have

    "asset_identifier": "CHAR", that needs to have "asset_identifier": "< string of the asset ID>"