APIs : cloudinary.uploader().updateMetadata & cloudinary.api().update not working !

Options
sramli
sramli Member Posts: 3

Hello dears !

I'm using Java SDK and facing issues with the mentioned APIs and get stuck :

1- uploader().dateMetadata : the callApi behind this method returns 404 error and looks like the not found html content is returned then updateMetadata end up with this exception

Invalid JSON response from server A JSONObject text must begin with '{' at 1 [character 2 line 1

my code is like :

metadata = asMap("my_metadata_external_id", "my_valye");
Map options = asMap("resource_type", "image", "type","upload");
// publicIds already fulfilled !
Map results = cloudinary.uploader().updateMetadata(metadata, publicIds, options);

2 - api().update : I tried this as an alternative to update metadata . The execution doesn't return any error , BUT nothing happened and it doesn't update the asset metadata values.

Map<String,Object> options = new HashMap() {{
    put("metadata", asMap("my_metadata_external_id", "my_valye"));
}};
cloudinary.api().update(publicId, options)


PS :

  • other api calls are working fine : eg =
cloudinary.uploader().addTag(tags, publicIds, EMPTY_MAP);
cloudinary.api().resource(publicId,EMPTY_MAP);
  • I tried also exactly the same samples in the documentation , but in vain same behavior !
  • I tried also python SDK but agin exactly the same behavior.


Any help / insights / guidance will be appreciated.

Best.

Tagged:

Answers

  • Tamara
    Tamara Member, Cloudinary Staff Posts: 99
    Options

    Hi there,

    I can't figure out your cloud name from the ticket so I can't look into our logs, but from my experience, you are not passing the cloud name correctly in your call.

    May I ask you to please double-check the way you are passing the cloud name, and try to upgrade to the newest version of our SDK and let me know if you were able to resolve this issue? If that. didn't help, can you please open a new private ticket with more information here?

    Looking forward to your response,

    Best,

    Tamara

  • sramli
    sramli Member Posts: 3
    Options

    Hi Tamara thanks for you response - The cloud name is correctly passed (and configured within CLOUDINARY_URL ) the proof is that (as I mentioned above) other calls are working fine (e.g cloudinary.uploader().addTag and cloudinary.api().resource ) in the same application and using the same CLOUDINARY_URL config.

    I tested using the latest SDK version.

    Best.

  • atdatu
    atdatu Member, Cloudinary Staff Posts: 9
    Options

    Hi @sramli ,

    Please try the following:

    // publicIds already fulfilled !
    Map results = cloudinary.uploader().updateMetadata(Cloudinary.asMap("my_metadata_external_id", "my_valye"), publicIds, Cloudinary.asMap("resource_type", "image", "type","upload"));
    

    Please let us know how it goes.

    Regards,

  • sramli
    sramli Member Posts: 3
    Options
    Hi guys ! thanks for your support. I was missing upload_prefix config
    Best