How to set access_control with Windows CLI?

gRail
gRail Member Posts: 1

Hello! I am trying to upload an asset and set the access_control to token. However, I can't seem to get the formatting right on the command.

call cld uploader upload 1.png -o use_filename true -o access_control '[{"access_type": "token"}]'
error: upload() takes 1 positional argument but 2 were given

It seems to be an issue with how I'm formatting the JSON; a coworker got a modified version to run on mac. But it sure isn't happy on windows. Thank you!

Tagged:

Answers

  • Ranson
    Ranson Cloudinary Staff Posts: 25

    Hello,

    I just sent a response to this on the Support ticket we were speaking on, but in-case anyone else runs into this issue I'll post the resolution here:

    The correct format is: cld uploader upload "1.png" -o use_filename true -o type authenticated -o access_control=[{""access_type"": ""token""}]

    Some things to note:
    When running the CLI command on Windows, you need to escape the double quotes within the curly braces using either \ or ", for example, \"text\" or ""text"".

    and

    The access_control parameter is handled a bit differently than the others where it is a single parameter&value that are not separated with a space.

    The others use the -o flag and are separated by parameter value .

    Running the code that I pasted will result in a success with the access control set as expected.