Expand my Community achievements bar.

SOLVED

How do i create a nt:file using Curl?

Avatar

Former Community Member

Hi,

I have gone through couple of blog post on how i can create nodes and sling:folders, everything works fine. However, i am not able to adapt those to nt:file. I want to create a nt:file and then once that is created, i want to paste some text into that file using curl. I always get 500 exception of Constraint Violation exception.

We want to setup new environments and i want this task to be automated.

Thanks for help in advance.

1 Accepted Solution

Avatar

Correct answer by
Employee

If you want to create an empty file, you can do something like this:

echo '' | curl -u admin:admin -T - http://localhost:4502/content/geometrixx/test.txt

That said, I don't understand why you want to do this in two steps (create an empty file, then set the file's content). If you have the file content, just create the file using that content in one step.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

If you want to create an empty file, you can do something like this:

echo '' | curl -u admin:admin -T - http://localhost:4502/content/geometrixx/test.txt

That said, I don't understand why you want to do this in two steps (create an empty file, then set the file's content). If you have the file content, just create the file using that content in one step.

Avatar

Former Community Member

justin_at_adobe wrote...

If you want to create an empty file, you can do something like this:

echo '' | curl -u admin:admin -T - http://localhost:4502/content/geometrixx/test.txt

That said, I don't understand why you want to do this in two steps (create an empty file, then set the file's content). If you have the file content, just create the file using that content in one step.

 

 

Thanks Justin,

I would be adding the text in one go. I was not sure of which script to use to do that.