# Get, create and delete key values

By
The Quable Team

Key values can be used to store a configuration or state for your scripts ...
We show you on this page how to get, create and delete key value(s).


# Get all key values

You can get a paginated list of all your key values by sending the following request:


curl --request GET \
     --url 'https://{{instance}}.quable.com/api/keyvalues?page=1&limit=100' \
     --header 'accept: application/hal+json'

{
    "@context": "/api/contexts/KeyValue",
    "@id": "/api/keyvalues",
    "@type": "hydra:Collection",
    "hydra:member": [
        {
            "@id": "/api/keyvalues/craftmypdfAttributeGroup",
            "@type": "KeyValue",
            "value": "{\n \"properties\": [ \"product_hardness_shore_a\"]\n\n}",
            "isProtected": false,
            "isPublic": true,
            "id": "craftmypdfAttributeGroup",
            "dateModified": "2023-03-24T09:02:51+00:00",
            "dateCreated": "2023-03-24T09:02:51+00:00"
        },
        {
            "@id": "/api/keyvalues/print_copyright",
            "@type": "KeyValue",
            "value": "Copyright ©",
            "isProtected": false,
            "isPublic": true,
            "id": "print_copyright",
            "dateModified": null,
            "dateCreated": null
        },
        {
            "@id": "/api/keyvalues/print_logo",
            "@type": "KeyValue",
            "value": "",
            "isProtected": false,
            "isPublic": true,
            "id": "print_logo",
            "dateModified": null,
            "dateCreated": null
        },
        {
            "@id": "/api/keyvalues/textmaster",
            "@type": "KeyValue",
            "value": "{\"connector\":{\"enabled\":true,\"api_key\":\"NSKLVeEsMg4\",\"api_secret\":\"fDKuEofh1f0\",\"url\":\"https:\\/\\/api.textmasterstaging.com\\/\",\"version\":\"v1\"}}",
            "isProtected": false,
            "isPublic": false,
            "id": "textmaster",
            "dateModified": "2021-04-01T10:07:45+00:00",
            "dateCreated": "2021-04-01T10:04:23+00:00"
        },
        {
            "@id": "/api/keyvalues/version",
            "@type": "KeyValue",
            "value": "5.18.0",
            "isProtected": true,
            "isPublic": true,
            "id": "version",
            "dateModified": "2020-12-05T21:28:58+00:00",
            "dateCreated": "2020-12-05T21:28:58+00:00"
        }
    ],
    "hydra:totalItems": 5,
    "hydra:view": {
        "@id": "/api/keyvalues?%2Fkeyvalues%2F=&limit=100",
        "@type": "hydra:PartialCollectionView"
    },
    "hydra:search": {
        "@type": "hydra:IriTemplate",
        "hydra:template": "/api/keyvalues{?order[id],code}",
        "hydra:variableRepresentation": "BasicRepresentation",
        "hydra:mapping": [
            {
                "@type": "IriTemplateMapping",
                "variable": "order[id]",
                "property": "id",
                "required": false
            },
            {
                "@type": "IriTemplateMapping",
                "variable": "code",
                "property": "code",
                "required": false
            }
        ]
    }
}

# Get one specific key value

If you wish to retrieve only one specific key value, the request looks like so:

curl --request GET \
     --url https://{{instance}}.quable.com/api/keyvalues/{{keyvalue-id}} \
     --header 'accept: application/ld+json'

And the response as follows:

{
    "@context": "/api/contexts/KeyValue",
    "@id": "/api/keyvalues/{{keyvalue-id}}",
    "@type": "KeyValue",
    "value": "{\n \"properties\": [ \"product_hardness_shore_a\"]\n\n}",
    "isProtected": false,
    "isPublic": true,
    "id": "keyvalue-id",
    "dateModified": "2023-03-24T09:02:51+00:00",
    "dateCreated": "2023-03-24T09:02:51+00:00"
}

# Create one key value

You can also create one key value by sending the following request:

curl --request POST \
     --url https://keyvalues/ \
     --header 'accept: application/ld+json' \
     --header 'content-type: application/json' \
     --data '
{
  "isProtected": false,
  "isPublic": false,
  "value": "newkeyvalue",
  "id": "NewKeyValue"
}
'

And the response:

{
    "@context": "/api/contexts/KeyValue",
    "@id": "/api/keyvalues/NewKeyValue",
    "@type": "KeyValue",
    "value": "newkeyvalue",
    "isProtected": false,
    "isPublic": false,
    "id": "NewKeyValue",
    "dateModified": "2023-11-21T14:29:38+00:00",
    "dateCreated": "2023-11-21T14:29:38+00:00"
}

# Delete key values

curl --request DELETE \
     --url https://{{instance}}.quable.com/api/keyvalues/{{keyvalue-id}}

This request should not return any response.