Dulitha,

There is no difference,  just set mediaType as you want i.e.
application/json and set content as stringify(json).

Further, I have extended carbon module's ArtifactManager to support
artifact insertion via JSON. Hope you can use it directly(Refer the add
method at [1])

    {
          name : 'My Gadget',
          lifecycles : ["development"],
          options : {
              "overview_name" : "My Gadget"
              "overview_urls" : ["http://example1.com";, "http://example2.com
"]
          }
    }

[1]
https://github.com/wso2/jaggery/blob/master/modules/carbon/scripts/registry/artifacts.js


On Sun, Jun 9, 2013 at 9:09 PM, Eranda Sooriyabandara <[email protected]>wrote:

> Hi Dulitha,
> Please refer
> http://docs.wso2.org/wiki/display/Governance450/Basic+Registry+API+Knowledge
> .
>
> thanks
> Eranda
>
>
>
> On Sun, Jun 9, 2013 at 8:58 PM, Chan <[email protected]> wrote:
>
>> Hi all,
>> I have to build an API to insert artifacts to the Greg (for the
>> Publisher). I got myself a registry instance and I want to know if there is
>> an API to insert JSON document to the Greg with the put method. I am
>> referring to the below code available in the samples.
>>
>>     gadget =
>>             <metadata xmlns="http://www.wso2.org/governance/metadata";>
>>                 <overview>
>>                     <provider>{provider}</provider>
>>                     <name>{name}</name>
>>                     <version>{version}</version>
>>                     <url>{url}</url>
>>                     <status>CREATED</status>
>>                 </overview>
>>                 <images>
>>                     <thumbnail>{thumbnails[thumbIndex]}</thumbnail>
>>                     <banner>{thumbnails[thumbIndex]}</banner>
>>                 </images>
>>             </metadata>;
>>     reg.put(path, {
>>         mediaType: 'application/vnd.wso2-gadget+xml',
>>         content: gadget.toXMLString()
>>     });
>>
>> Thank you,
>> --
>> Chan (Dulitha Wijewantha)
>> Software Engineer - Mobile Development
>> WSO2Mobile
>> Lean.Enterprise.Mobileware
>>  * ~Email       [email protected]*
>> *  ~Mobile     +94712112165*
>> *  ~Website   dulithawijewantha.com
>> *
>> *  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>> *
>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>
>
>
>
> --
> *Eranda Sooriyabandara
> *Software Engineer;
> Integration Technologies Team;
> WSO2 Inc.; http://wso2.com
> Lean . Enterprise . Middleware
>
> E-mail: eranda AT wso2.com
> Mobile: +94 716 472 816
> Linked-In: http://www.linkedin.com/in/erandasooriyabandara
> Blog: http://emsooriyabandara.blogspot.com/
>
>
>
> *
> *
>



-- 
*Ruchira Wageesha
**Associate Technical Lead** & Member, Management Committee, Development
Technologies*
*WSO2 Inc. - lean . enterprise . middleware |  wso2.com*
*
email: [email protected],   blog: ruchirawageesha.blogspot.com,   mobile:
+94 77 5493444*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to