{"action":"closed","issue":{"url":"https://api.github.com/repos/mailjet/api-documentation/issues/20","repository_url":"https://api.github.com/repos/mailjet/api-documentation","labels_url":"https://api.github.com/repos/mailjet/api-documentation/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/mailjet/api-documentation/issues/20/comments","events_url":"https://api.github.com/repos/mailjet/api-documentation/issues/20/events","html_url":"https://github.com/mailjet/api-documentation/issues/20","id":369087230,"node_id":"MDU6SXNzdWUzNjkwODcyMzA=","number":20,"title":"Contact meta values sent via API are transformed to lowercase","user":{"login":"franz-josef-kaiser","id":387666,"node_id":"MDQ6VXNlcjM4NzY2Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/387666?v=4","gravatar_id":"","url":"https://api.github.com/users/franz-josef-kaiser","html_url":"https://github.com/franz-josef-kaiser","followers_url":"https://api.github.com/users/franz-josef-kaiser/followers","following_url":"https://api.github.com/users/franz-josef-kaiser/following{/other_user}","gists_url":"https://api.github.com/users/franz-josef-kaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/franz-josef-kaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franz-josef-kaiser/subscriptions","organizations_url":"https://api.github.com/users/franz-josef-kaiser/orgs","repos_url":"https://api.github.com/users/franz-josef-kaiser/repos","events_url":"https://api.github.com/users/franz-josef-kaiser/events{/privacy}","received_events_url":"https://api.github.com/users/franz-josef-kaiser/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-11T12:00:29Z","updated_at":"2018-10-11T12:40:37Z","closed_at":"2018-10-11T12:40:37Z","author_association":"NONE","body":"### Situation\r\n\r\nWe noticed that the values for contact meta data get lower cased, when sent via the API.\r\n*Condition:* This happened when adding new contact meta data the via `/contactmetadata` ressource (API endpoint). It also happens, when setting values for a single contacts meta data.\r\n*Problem:* This makes it impossible to use the data in a campaign or in marketing automation. We write German and English E–Mails, so we need upper cased values as well (goes for English as well, w.g. City names).\r\n\r\n### Expected Result\r\nWhen add a new contactmetadata property (or a value), the string would be expected to get persistent \"as sent\".\r\n\r\n### Actual Result\r\n\r\n* Sent: `Name`. \r\n* Received: `name` (lowercase).\r\n\r\n### How to reproduce\r\n\r\n1. Set up a new directory named `contactmetadata`.\r\n1. Add a new file: `{name|titel|foo}.json`.\r\n\r\n    ```\r\n    $ # fs structure\r\n    -\\ contactmetadata\r\n      |- name.json\r\n      |- titel.json\r\n      |- ….json\r\n    contact-metadata-create.sh\r\n    ```\r\n1. Add a new (bash|shell) file: `contact-metadata-create.sh`.\r\n1. Add a new file named `mjapikey` (without extension) and fill it with your API key + private key, comma separated.\r\n1. Add a new file named `name.json` to the `/contactmetadata` directory with the following contents:\r\n\r\n    ```\r\n    {\r\n    \t\"Name\": \"name\",\r\n    \t\"Datatype\": \"str\",\r\n    \t\"Namespace\": \"static\"\r\n    }\r\n    ```\r\n1. Install `jq` for human readable JSON output in your CLI. Or install `json_pp` (and change below script accordingly).\r\n\r\n1. Add the following contents to the shell script:\r\n\r\n    ```\r\n    #!/usr/bin/env bash\r\n    DATA=\"$(pwd)/${2}\"\r\n\r\n    # Single file:\r\n    if [[ -f $DATA ]]; then\r\n        curl -sX POST https://api.mailjet.com/v3/REST/contactmetadata \\\r\n            --user \"${1}\" \\\r\n            --header 'Content-Type: application/json' \\\r\n            -d @${DATA} |jq\r\n    # Directory of meta data JSON definitions:\r\n    else\r\n        CONFIG=\"${DATA}/*.json\"\r\n        for file in $CONFIG\r\n        do\r\n            echo \"\\n --------------------\"\r\n            echo \" *CONFIG:* ${file}\"\r\n            jq '.' ${file}\r\n            echo \" *REQUEST:* \"\r\n            echo \" *RESPONSE:* \"\r\n            curl -sX POST https://api.mailjet.com/v3/REST/contactmetadata \\\r\n                --user \"${1}\" \\\r\n                --header 'Content-Type: application/json' \\\r\n                -d @${file} |jq\r\n        done\r\n    fi\r\n    exit 1\r\n    ```\r\n\r\n    1. Call the script on the command line. It will loop through all JSON files (each is a single contact meta data/ property definition for one [sub]account) in your `contactmetadata` folder\r\n    ```\r\n    $ sh contact-metadata-create.sh $(cat mjkey) contactmetadata\r\n    ```"}}
{"actor":{"display_login":"franz-josef-kaiser"}}