Wednesday, June 25, 2014

How to add binary property for Node in CQ

Motivation: Recently I was trying to add some binary property to a node through file system (As part of code deployment). Had hard time figuring out how we can do that.

Use Case: You need to add some Binary property to a node through file system. (One use case is adding SAML cert as property idp_cert under /etc/key/saml)


Option 1:

You can use following curl command to do that (Look at \< )

curl -u UID:PWD -F property_name=\<File location -F property_name@TypeHint=Binary http://HOST:PORT/PATH_WHERE_YOU_WANT_TO_ADD_THIS_PROP

If you are trying to upload a file instead of property, You can use something like, (This is even true for if you want to install a bundle using repo path in that case repo path would be something like /apps/your_app/install if this is Adobe bundle then something like /libs/adobe_modules/install and if this is system bundle (Like Authentication bundles) then it would be something like /libs/system/install

curl -u UID:PWD -T File_Location HOST:PORT/PATH

Option 2: 

You can use .content.xml to create property like this

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="" xmlns:jcr="" xmlns:rep="internal"

And then create a file called  your_property-name.binary at same level and dump your binary content there. When you use maven-content-plugin to build package now, vlt knows how to transform this to a binary property.

----- /somepath
-------- .content.xml
-------- your_property_name.binary

Note that there are various way to create actual binary content in CQ using curl and some of them you can check here 


  1. Hi ,
    How can i add a cq node with specific type, for an example Long type.

    curl -u admin:admin -X POST --data size=70 http://localhost:4502/content/

    if i use the above command it will create a node but with sting type. i want to make it Long.

    1. If you are trying to add property to Node with a type then you can use @TypeHint more example here

  2. This comment has been removed by a blog administrator.

  3. I exactly got what you mean, thanks for posting. And, I am too much happy to find this website on the world of Google. House for Sale

  4. Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good. Ann Arbor Apartments

  5. One of the more impressive blogs Ive seen. Thanks so much for keeping the internet classy for a change. Youve got style, class, bravado. I mean it. Please keep it up because without the internet is definitely lacking in intelligence. Boulevard 88 floor plan

  6. It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. house for Sale

  7. I real glad to uncover this web internet site on bing, just what I was searching for. Buy new gutters

  8. Regular visits listed here are the easiest method to appreciate your energy, which is why why I am going to the website everyday, searching for new, interesting info. Many, thank you  Click here