Signing back into the Community for the first time? You'll need to reset your password to access your account.  Find out more.

Forum Discussion

Former Member's avatar
Former Member
4 years ago

add a field via PATCH

I'm trying to add a new field to an item via PATCH

As I understand from the RFC https://datatracker.ietf.org/doc/html/rfc6901 I can pass something like

```
{
"path": "/fields/4",
"op": "add",
"value": {
"label": "pkcs12base64",
"type": "STRING",
"value": "MIIRuQIB...."
}
}

```

and I will find a new field at position 4 if I have 4 fields already there

I receive a 400 Invalid request body or parameter

How should it be done instead?

Thanks


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

  • Former Member's avatar
    Former Member

    Hi there,

    You should be able to add a new field with the following:
    [
    {
    "op": "add",
    "path": "/fields",
    "value": {
    "label": "pkcs12base64",
    "type": "string",
    "value": "MIIRuQIB...."
    }
    }
    ]

    Note that you do not need to include a position number for the new field. See here for more information on performing patch operations. You can also view the api spec here for more examples.