Hi Mari,

I could n't mention that you can not access metadata API without the token.
There are two ways to obtain the token, which is created for the app and
passed as payload into the instance. Either loginto the instance and obtain
the token or, enable debug logs to view the payload. I am wondering how you
could add property without the token.

 curl -X POST -d "@prop.json"  -H "Content-Type: application/json" -k -H
"Authorization: Bearer
eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjExNzcxNTU4MDUsInN1YiI6ImFkbWluIiwiYXpwIjoiS05QVGNZZ0R6ZkxWTVVTWTFSSV9hZ1J1X1ZBYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsiS05QVGNZZ0R6ZkxWTVVTWTFSSV9hZ1J1X1ZBYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjExNzcxNTY4MDZ9.fsJ8gOUWxyT_JhUkOQ_eG1Q5Z5cXdaKUKUhJppBK0Sejd7QhW5sZHXzWcNgO96yLPx7HOoiuVGbEVmf2Hjka_ARGRaEu51BZsXenu1X6FCSf7QXdU8n5MtD-xDuAIApxNl0TJ8J8cvcouDySYzKSP6x93kYTIRp9ubujxQgiEZc"
 -k  https://
${host_ip}:${host_port}/metadata/api/application/udara/properties

{
    "properties": [
        {
            "key": "email",
            "values": [
                "udaraliyan...@gmail.com",
                "ud...@wso2.com"
            ]
        },
        {
            "key": "name",
            "values": [
                "udara"
            ]
        }
    ]
}


curl -X GET -H "Authorization: Bearer
eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjExMTU0NjAxNTUsInN1YiI6ImFkbWluIiwiYXpwIjoiRjZxbzZ4d2ZNZFcwQzhISENPRGlYYVd2NUNjYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsiRjZxbzZ4d2ZNZFcwQzhISENPRGlYYVd2NUNjYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjExMTU0NjExNTZ9.gLpqkdve6ZtZzdd0e-s6dWqvQHso16TkGkYOuuZChbY6J9ROSmmi0hrNm-jqnjBj5py0A-eaLtC2_vhs97x7WdENLz1Oqe9l7zLelWVqsmNcnv9w2rWNNQdWDY4VLSyFj6Wqlp8zB7UcFsB8oYNallmofWIOR7aa1f3--TjSI9s"
 -k  https://
${host_ip}:${host_port}/metadata/api/application/udara/properties
{"properties":[{"key":"email","values":["udaraliyan...@gmail.com","
ud...@wso2.com"]},{"key":"name","values":"udara"}]}


On Tue, May 12, 2015 at 7:03 AM, Udara Liyanage <ud...@wso2.com> wrote:

> Hi Mari,
>
> I will have a look.
> On 11 May 2015 10:17 pm, "Mariangela Hills" <mariang...@wso2.com> wrote:
>
>> Hi Vishanth,
>>
>> I executed the REST API command using the new JSON definition, but I
>> still get an error.
>>
>> MariH:Master-branch Admin16$ curl -X POST -H "Content-Type:
>> application/json" -d @'property.json' -k -v -u admin:admin
>> https://localhost:9443/metadata/api/application/wordpress/properties
>> > POST /metadata/api/application/wordpress/properties HTTP/1.1
>> > Authorization: Basic YWRtaW46YWRtaW4=
>> > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0
>> OpenSSL/0.9.8| zlib/1.2.5
>> > Host: localhost:9443
>> > Accept: */*
>> > Content-Type: application/json
>> > Content-Length: 119
>> >
>> * upload completely sent off: 119 out of 119 bytes
>> < HTTP/1.1 500 Internal Server Error
>> < Date: Mon, 11 May 2015 16:43:31 GMT
>> < Content-Type: application/json
>> < Content-Length: 152
>> < Connection: close
>> < Server: WSO2 Carbon Server
>> <
>> {"Error":{ "errorCode": " 500", "errorMessage": "
>> org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML
>> character is specified. "}}
>>
>> Regards,
>> Mariangela
>>
>>
>>
>>
>> *--*
>> *Mariangela Hills*
>> PMC Member & Committer of Apache Stratos
>> Senior Technical Writer
>> WSO2, Inc.
>> lean.enterprise.middleware.
>> m: +94 773 500185
>> w: http://wso2.com
>> <http://wso2.com/events/>
>>
>> On Mon, May 11, 2015 at 9:14 PM, Udara Liyanage <ud...@wso2.com> wrote:
>>
>>> Hi Mari,
>>>
>>> Correct format is the one Vishanth mentioned
>>> On 11 May 2015 8:32 pm, "Vishanth Balasubramaniam" <vishan...@wso2.com>
>>> wrote:
>>>
>>>> Hi Mari,
>>>>
>>>> It should be as follows.
>>>> [
>>>>    {
>>>>       "key":"wka5",
>>>>       "values":"192.163.4.2"
>>>>    },
>>>>    {
>>>>       "key":"wka6",
>>>>       "values":"192.163.6.6"
>>>>    }
>>>> ]
>>>>
>>>> Regards,
>>>> Vishanth
>>>>
>>>>
>>>> On Mon, May 11, 2015 at 7:49 PM, Mariangela Hills <mariang...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi Devs,
>>>>>
>>>>> I was trying to add properties to an application (POST
>>>>> /metadata/api/application/<APPLICATION_ID>/properties) and got an error
>>>>> [1]. There were no corresponding log files printed. I used [2] as the 
>>>>> JSON.
>>>>>
>>>>>
>>>>>
>>>>> [1]
>>>>> MariH:Master-branch Admin16$ curl -X POST -H "Content-Type:
>>>>> application/json" -d @'meta.json' -k -v -u admin:admin
>>>>> https://localhost:9443/metadata/api/application/wordpress/properties
>>>>> > POST /metadata/api/application/wordpress/properties HTTP/1.1
>>>>> > Authorization: Basic YWRtaW46YWRtaW4=
>>>>> > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0
>>>>> OpenSSL/0.9.8| zlib/1.2.5
>>>>> > Host: localhost:9443
>>>>> > Accept: */*
>>>>> > Content-Type: application/json
>>>>> > Content-Length: 131
>>>>> >
>>>>> * upload completely sent off: 131 out of 131 bytes
>>>>> < HTTP/1.1 500 Internal Server Error
>>>>> < Date: Mon, 11 May 2015 14:06:03 GMT
>>>>> < Content-Type: application/json
>>>>> < Content-Length: 152
>>>>> < Connection: close
>>>>> < Server: WSO2 Carbon Server
>>>>> <
>>>>> * Closing connection #0
>>>>> * SSLv3, TLS alert, Client hello (1):
>>>>> {"Error":{ "errorCode": " 500", "errorMessage": "
>>>>> org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML
>>>>> character is specified. "}}
>>>>>
>>>>> ------------------------------------
>>>>>
>>>>> [2]
>>>>> [
>>>>>    {
>>>>>       "key":"wka5",
>>>>>       "values":[
>>>>>          "192.163.4.2"
>>>>>       ]
>>>>>    },
>>>>>    {
>>>>>       "key":"wka6",
>>>>>       "values":[
>>>>>          "192.163.6.6"
>>>>>       ]
>>>>>    }
>>>>> ]
>>>>>
>>>>>
>>>>> Regards,
>>>>> Mariangela
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *--*
>>>>> *Mariangela Hills*
>>>>> PMC Member & Committer of Apache Stratos
>>>>> Senior Technical Writer
>>>>> WSO2, Inc.
>>>>> lean.enterprise.middleware.
>>>>> m: +94 773 500185
>>>>> w: http://wso2.com
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Vishanth Balasubramaniam*
>>>> Software Engineer
>>>> WSO2 Inc.; http://wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: *+94771737718*
>>>> about me: *http://about.me/vishanth <http://about.me/vishanth>*
>>>>
>>>>
>>


-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897

Reply via email to