Creating new item

mbates
mbates
Community Member

I am testing the CLI functionality for creating a new database item. I followed the examples and suggestions here in the knowledge base, but still continue to get "error decoding JSON (invalid character 'ÿ' looking for beginning of value); error decoding base64 (illegal base64 data at input byte 0) - item data doesn't appear to be JSON or base64url encoded JSON: illegal base64 data at input byte 0"
I am using the command op get template "Database" > dbase.json to get a copy of the template. I then edit the json file to the specifics I am trying to enter (json file below), and finally I enter the command op create item --template=dbase.json Database.

What am I doing wrong? I have seen other posts describing using the op encode command, but the help files on this version says there is no need to use op encode anymore.

Thanks.

{
"notesPlain":"",
"passwordHistory":[

],
"sections":[
{
"fields":[
{
"k":"menu",
"n":"database_type",
"t":"type",
"v":"mssql"
},
{
"k":"string",
"n":"hostname",
"t":"server",
"v":"NNSQL-TST02"
},
{
"k":"string",
"n":"port",
"t":"port",
"v":""
},
{
"k":"string",
"n":"database",
"t":"database",
"v":"UNIQUE"
},
{
"k":"string",
"n":"username",
"t":"username",
"v":"sa"
},
{
"k":"concealed",
"n":"password",
"t":"password",
"v":"th1s1smyp455w0rd"
},
{
"k":"string",
"n":"sid",
"t":"SID",
"v":""
},
{
"k":"string",
"n":"alias",
"t":"alias",
"v":""
},
{
"k":"string",
"n":"options",
"t":"connection options",
"v":""
}
],
"name":"",
"title":"Database"
}
]
}


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided

Comments

  • Hi @mbates,

    What version of the CLI are you currently using to try and create this item? You can double check using op -v

  • mbates
    mbates
    Community Member

    I am using 1.12.3

  • I was able to create the item locally using the json you provided and the same command what you provided: op create item Database --template=dbase.json

    The error suggests there is an encoding issue in the json that you are providing to the command. Is it possible to run the json file you have through a json validation tool? This may help fix any issues with the json that are causing the error.

    Let me know if validating the json helps.

  • mbates
    mbates
    Community Member

    Interesting....Yes, one of the first steps I took in troubleshooting was to confirm my text with a json validation tool. It checks out as correct. I am running this on Windows Server 2019 Standard, wonder if that could be an issue. I'm going to try it on my Windows 10 machine and see if it makes any difference.

  • mbates
    mbates
    Community Member

    I get the same thing on my Windows 10 machine. I tried using the 386 version instead of the 64 bit version and same thing. I also stepped back to the 1.11.4 version, did the op encode first and still get the error that the data isn't JSON or base64url encoded JSON.

  • Perhaps this is a consequence windows encoding as I was testing it locally on a Mac machine. We will try to test this out on a Windows machine and see if we are able to reproduce a similar error.

This discussion has been closed.