Is there a defined format for item json responses

iansaccount
iansaccount
Community Member

I'm trying to write a CLI wrapper around the CLI tool, and I'm trying to parse the json into structs. I can't find the json format anywhere. If it exists in the documentation, where is it? Thanks.


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

Comments

  • csharpsteen
    csharpsteen
    Community Member

    I'm also interested in this as the format seems to vary quite a bit between templates. For example:

    • Login has "fields" with "designation", "name", "type", and "values"

    • Password just has "password"

    • Most (all?) items have "sections", those have a "name", a "title" and "fields". But these "fields" are different than Login "fields", they have "k", "n", "t", and "v" which seem to be analogous to "designation", "name", "type", and "values" despite being named differently and possibly in a different order.

    I think I see how it fits together, but it would be great to have something like a JSON schema that lays out what fields are available for each template --- this would cut down on the amount of assumption and guesswork.

  • felix_1p
    felix_1p
    1Password Alumni

    @iansaccount , @csharpsteen Sorry for the late reply.

    As you can imagine we are not necessarily happy with the structure and its sometimes cryptic field names. That's why are working on a simplified structure.

    But @csharpsteen pretty much figured it out. Login and Password items are slightly different for historical reasons. Regardless, every item stores data in fields inside sections, where each fields consists of

    • K the field type.
    • N the (internal) field name
    • T the (user visible) field title
    • V the field value. Most often than not it's just a string, but there are some field types (e.g. address) for which the value is more complex.

    To the best of my knowledge we don't have a comprehensive list of standard fields for the available item types, so looking at the templates themselves (op get template) is your best bet atm. But I will double check on that.

  • MrC
    MrC
    Volunteer Moderator

    @csharpsteen ,

    Look at the Utils/PIF.pm file in the converter suite.

This discussion has been closed.