How do i create a nt:file using Curl? | Community
Skip to main content
October 16, 2015
Solved

How do i create a nt:file using Curl?

  • October 16, 2015
  • 2 replies
  • 1198 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

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.

2 replies

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

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.

October 16, 2015

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.