Creating a new item fails with error illegal base64 data at input byte

TERW_DANTERW_DAN
edited September 2017 in CLI Beta

I'm trying to create a new item from the onepassword CLI by using
'op create item login' followed by a json gotten from the template.

However, by doing this this results in an error 'illegal base64 at input byte 10'. If I enter anything else, I'll get an error 'missing argument: item details' .
The documentation is lacking any example of how to add an item, so how do I get a correct json to a new item so it can be created?

The JSON I'm using now:
{"notesPlain":"","sections":[],"passwordHistory":[],"fields":[{"value":"","name":"username","type":"T","designation":"username"},{"value":"","name":"password","type":"P","designation":"password"}]}

Using 'op create item login --title=test --url=testurl' doesn't work, since that is missing arguments.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Ubuntu 15.10
Sync Type: Not Provided

Comments

  • cohixcohix

    Team Member
    edited September 2017

    Hey @TERW_DAN ! Thanks for writing in. The trick here is you need to encode the item's json before passing it into the create item command. We have the op encode command for just that.

    Try this: op create item login $([your json] | op encode)

    I suggest using the tool jq to modify the template data before passing it into op encode, or putting the template in a file and editing it with your text editor. You can read a template from disk and put it through op encode like this: $(cat file.json | op encode)

    Let me know how that works out :)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file