Comments (5)
Well, technically no other expectation has been set than strings but yes, I agree it would be nice to be able to write other types.
Do you have a link to how this works if I use curl?
from aem-cmd.
@bjorns: In fact I realize now this is not a bug, but rather a feature request, because users can set the type via TypeHint
's.
The curl
syntax would be:
curl -vv -u admin:admin -X POST --data 'aemFlag=true&aemFlag@TypeHint=Boolean&aemArr=[1,2,3,4,5]&aemArr@TypeHint=String[] http://localhost:4502/etc/tags/geometrixx-outdoors'
or the same thing but in a more readable form:
curl -vv -u admin:admin \
-F aemFlag=true \
-F aemFlag@TypeHint="Boolean" \
-F aemArr="[1,2,3,4]" \
-F "aemArr@TypeHint=String[]" \
http://localhost:4502/etc/tags/geometrixx-outdoors \
Adding support for it in the tool would mean interpreting value prefixes like {Boolean}true
and converting them to extra TypeHint parameters, as documented at https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html#typehint
For booleans that are set to false that would also involve adding the @Delete:true
type hint, since CQ deletes false properties rather than setting them to {Boolean}false.
from aem-cmd.
Ok, I think I'm going to put some basic type recognition and add a --typeHint flag just in case.
from aem-cmd.
Implemented integer and boolean support in 983666d
Unfortunately requests doesn't support having multiple form fields with the same name which seems to be what is required to set array data so that will remain known issue for the forseable future.q
from aem-cmd.
@bjorns: Just for reference: in fact, requests can send multiple form fields with the same name. This is accomplished by sending a multipart/form-data
POST request rather than a application/x-www-form-urlencoded
POST where the files
parameter is a tuple so that multiple fields with the same name can be sent.
AEM itself uses multipart form encoding for most POST operations rather than www-form-urlencoded
.
The requests
equivalent would be requests.post('http://httpbin.org/post', files=dict(foo='bar'))
which I have found to be tricky to use since it requires ugly and un-intuitive syntax when you don't want to include files, given that files
is mainly meant for file uploading and the API for using it for multipart form posting without files is imo faulty.
A nicer alternative to using files
is the requests_toolbelt which is an extension for requests
. I included an example at http://stackoverflow.com/a/35974071 which basically looks like:
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
multipart_data = MultipartEncoder(
fields=(
('action', 'store'),
('path', '/path1'),
('path', '/path2'),
('path', '/path3'),
)
)
response = requests.post('http://httpbin.org/post', data=multipart_data, headers={'Content-Type': multipart_data.content_type})
from aem-cmd.
Related Issues (20)
- Get latest version when installing packages. HOT 1
- Support https in server HOT 1
- How should autocomplete on remote servers work?
- Autocomplete users and groups.
- autocomplete paths in replication tool HOT 1
- Send error if bad server name HOT 1
- Error handling when downloading package twice to same place HOT 1
- Dispatcher clean doesn't report errors HOT 1
- TypeError: 'dict' object is not callable HOT 2
- Send parameters to server-side code
- Add replication support to package tool HOT 1
- Add touch command to jcr tool for creating nodes
- Use multipart/form-data for POST requests HOT 1
- Creating package with filters HOT 1
- Groovy command has incorrect help text HOT 1
- The ability to pass the host,username and password in the command HOT 2
- Support encrypted passwords in .acmd.rc file HOT 1
- [[Bug]] Fetching User List Possibly Broken?
- Fix dispatcher clear HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aem-cmd.