------=_Part_32071891_1853162604.1345448307836
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
adding Ori, comment inside=20
----- Original Message -----
From: "Karli Sj=C3=B6berg" <Karli.Sjoberg(a)slu.se>
To: "Karli Sj=C3=B6berg" <Karli.Sjoberg(a)slu.se>
Cc: "users" <users(a)ovirt.org>
Sent: Monday, August 20, 2012 9:25:19 AM
Subject: Re: [Users] Create domain user with api
Hey all, I kind of figured this out on my own. Still have some kinks
to iron out, from the web perspective, but I=C2=B4ll get back to you on
that. In the mean time I noticed a rather strange redirection sent
back when adding a user. Check this out:
# curl -v -X POST -H "Accept: application/xml" -H
"Accept:
application/xml" -H "Content-type: application/xml" -u
admin@internal:letmein! -T upload.xml
http://engine.slu.se:80/api/users
upload.xml:
<user>
<user_name>somename(a)slu.se</user_name>
<domain id=3D"61642e73-6c75-2e73-6561-642e736c752e" />
maybe i missed something, but why you have domain id under user?=20
user entity has 'domain' which is the directory server.=20
<role>
<name>SomeRole</name>
</role>
</roles>
</user>
* About to connect() to engine.slu.se port 80 (#0)
* Trying XXX.XXX.XXX.XXX... connected
* Connected to engine.slu.se (XXX.XXX.XXX.XXX) port 80 (#0)
* Server auth using Basic with user 'admin@internal'
POST /api/users HTTP/1.1
Authorization: Basic YWRtaW5AaW50ZXJuYGH4UiXVhaDJkYWk=3D
User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7
OpenSSL/0.9.8r zlib/1.2.3
Host: engine.slu.se
Accept: application/xml
Accept: application/xml
Content-type: application/xml
Content-Length: 184
Expect: 100-continue
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Fri, 17 Aug 2012 13:47:00 GMT
< Set-Cookie: JSESSIONID=3DLXBbH1Wcmv-jepsSl06FtMaA.undefined;
Path=3D/api
< Location:
http://engine.slu.se /api/api/
domains/61642e73-6c75-2e73-6561-642e736c752e/users/94155e69-4691-4cbb-a6b=
5-d30a6bd5b667
< Content-Type: application/xml
< Connection: close
< Transfer-Encoding: chunked
<
That Location is invalid. Proper location would be:
< Location:
http://engine.slu.se/
api/domains/61642e73-6c75-2e73-6561-642e736c752e/users/94155e69-4691-4cbb=
-a6b5-d30a6bd5b667
Bug?
/Karli
17 aug 2012 kl. 10.45 skrev Karli Sj=C3=B6berg:
> Hey all,
=20
> using "ovirt-shell" I can do:
=20
> $ create user --user_name somename(a)foo.bar --domain-name
> something.foo.bar
=20
> How do express that as a POST with the api? Could you provide a
xml
> example?
=20
> Med V=C3=A4nliga H=C3=A4lsningar
=20
> -----------------------------------------------------------------------=
--------
=20
> Karli Sj=C3=B6berg
=20
> Swedish University of Agricultural Sciences
=20
> Box 7079 (Visiting Address Kron=C3=A5sv=C3=A4gen 8)
=20
> S-750 07 Uppsala, Sweden
=20
> Phone: +46-(0)18-67 15 66
=20
> karli.sjoberg(a)slu.se
=20
> _______________________________________________
=20
> Users mailing list
=20
> Users(a)ovirt.org
=20
>
http://lists.ovirt.org/mailman/listinfo/users
=20
Med V=C3=A4nliga H=C3=A4lsningar
-------------------------------------------------------------------------=
------
Karli Sj=C3=B6berg
Swedish University of Agricultural Sciences
Box 7079 (Visiting Address Kron=C3=A5sv=C3=A4gen 8)
S-750 07 Uppsala, Sweden
Phone: +46-(0)18-67 15 66
karli.sjoberg(a)slu.se
_______________________________________________
Users mailing list
Users(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
------=_Part_32071891_1853162604.1345448307836
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html><head><style type=3D'text/css'>p { margin: 0;
}</style></head><body><=
div style=3D'font-family: times new roman,new york,times,serif; font-size: =
12pt; color: #000000'>adding Ori, comment inside<br><br><hr
id=3D"zwchr"><b=
lockquote style=3D"border-left:2px solid rgb(16, 16, 255);margin-left:5px;p=
adding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decora=
tion:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From:
=
</b>"Karli Sj=C3=B6berg"
&lt;Karli.Sjoberg(a)slu.se&gt;<br><b>To: </b>"Karli =
Sj=C3=B6berg" &lt;Karli.Sjoberg(a)slu.se&gt;<br><b>Cc:
</b>"users" <users@=
ovirt.org><br><b>Sent: </b>Monday, August 20, 2012 9:25:19
AM<br><b>Subj=
ect: </b>Re: [Users] Create domain user with api<br><br>Hey all, I kind
of =
figured this out on my own. Still have some kinks to iron out, from the web=
perspective, but I=C2=B4ll get back to you on that. In the mean time I not=
iced a rather strange redirection sent back when adding a user. Check this =
out:<div><br></div><div># curl -v -X POST -H
"Accept: application/xml"=
-H "Accept: application/xml" -H "Content-type: application/xml" -u
admin@i=
nternal:letmein! -T upload.xml <a href=3D"http://engine.slu.se:80/api/users=
"
target=3D"_blank">http://engine.slu.se:80/api/users</a></div><div><br></d=
iv><div>upload.xml:</div><div><div><user></div><div>
<user_n=
ame&gt;somename(a)slu.se&lt;/user_name&gt;</div><div>&nbsp;
<domain id=3D"=
61642e73-6c75-2e73-6561-642e736c752e" /></div><div
id=3D"DWT3381"> =
</div></div></blockquote>maybe i missed something, but why you have
domain=
id under user?<br>user entity has 'domain' which is the directory
server.<=
br><blockquote style=3D"border-left: 2px solid rgb(16, 16, 255); margin-lef=
t: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-s=
tyle: normal; text-decoration: none; font-family: Helvetica,Arial,sans-seri=
f; font-size:
12pt;"><div><div><roles></roles></div><div>
<=
role></div><div>
<name>SomeRole</name></=
div><div>
</role></div><div>
</roles></div><=
div></user></div></div><div><br></div><div><div>*
About to connect() =
to <a href=3D"http://engine.slu.se"
target=3D"_blank">engine.slu.se</a> por=
t 80 (#0)</div><div>* Trying XXX.XXX.XXX.XXX...
connected</div><div>=
* Connected to <a href=3D"http://engine.slu.se"
target=3D"_blank">engine.sl=
u.se</a> (XXX.XXX.XXX.XXX) port 80 (#0)</div><div>* Server auth using
Basic=
with user 'admin@internal'</div><div>POST /api/users
HTTP/1.1</div><div>Au=
thorization: Basic YWRtaW5AaW50ZXJuYGH4UiXVhaDJkYWk=3D</div><div>User-Agent=
: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zl=
ib/1.2.3</div><div>Host: <a href=3D"http://engine.slu.se"
target=3D"_blank"=
engine.slu.se</a></div><div>Accept:
application/xml</div><div>Accept: appl=
ication/xml</div><div>Content-type:
application/xml</div><div>Content-Lengt=
h: 184</div><div>Expect:
100-continue</div><div><br></div><div>< HTTP/1.=
1 100 Continue</div><div>< HTTP/1.1 201
Created</div><div>< Date: Fri=
, 17 Aug 2012 13:47:00 GMT</div><div>< Set-Cookie:
JSESSIONID=3DLXBbH1Wc=
mv-jepsSl06FtMaA.undefined; Path=3D/api</div><div>< Location: <a
href=3D=
"http://engine.slu.se"
target=3D"_blank">http://engine.slu.se</a><b>/api/ap=
i/</b>domains/61642e73-6c75-2e73-6561-642e736c752e/users/94155e69-4691-4cbb=
-a6b5-d30a6bd5b667</div><div>< Content-Type:
application/xml</div><div>&=
lt; Connection: close</div><div>< Transfer-Encoding:
chunked</div><div>&=
lt;</div><div><br></div><div>That Location is invalid.
Proper location woul=
d be:</div><div>< Location: <a
href=3D"http://engine.slu.se/" target=3D"=
_blank">http://engine.slu.se/</a>api/domains/61642e73-6c75-2e73-6561-642e73=
6c752e/users/94155e69-4691-4cbb-a6b5-d30a6bd5b667</div><div><br></div><div>=
Bug?</div><div><br></div><div>/Karli</div><div><br></div><div><div>17
aug 2=
012 kl. 10.45 skrev Karli Sj=C3=B6berg:</div><br
class=3D"Apple-interchange=
-newline"><blockquote><div style=3D"word-wrap:
break-word;">Hey all,<div><b=
r></div><div>using "ovirt-shell" I can
do:</div><div>$ create user --u=
ser_name <a href=3D"mailto:somename@foo.bar"
target=3D"_blank">somename@foo=
.bar</a> --domain-name
something.foo.bar</div><div><br></div><div>How do ex=
press that as a POST with the api? Could you provide a xml example?</div><d=
iv><br><div>
<div><br
class=3D"Apple-interchange-newline"><br></div><div>Med
V=C3=A4nlig=
a H=C3=A4lsningar<br>------------------------------------------------------=
-------------------------<br>Karli Sj=C3=B6berg<br>Swedish University of Ag=
ricultural Sciences<br>Box 7079 (Visiting Address Kron=C3=A5sv=C3=A4gen 8)<=
br>S-750 07 Uppsala, Sweden<br>Phone: +46-(0)18-67 15
66</div><div><a=
href=3D"mailto:karli.sjoberg@adm.slu.se"
target=3D"_blank">karli.sjoberg@s=
lu.se</a></div>
</div>
<br></div></div>_______________________________________________<br>Users
ma=
iling list<br><a href=3D"mailto:Users@ovirt.org"
target=3D"_blank">Users@ov=
irt.org</a><br>http://lists.ovirt.org/mailman/listinfo/users&...
e></div><br><div>
<div><br
class=3D"Apple-interchange-newline"><br></div><div>Med
V=C3=A4nlig=
a H=C3=A4lsningar<br>------------------------------------------------------=
-------------------------<br>Karli Sj=C3=B6berg<br>Swedish University of Ag=
ricultural Sciences<br>Box 7079 (Visiting Address Kron=C3=A5sv=C3=A4gen 8)<=
br>S-750 07 Uppsala, Sweden<br>Phone: +46-(0)18-67 15
66</div><div><a=
href=3D"mailto:karli.sjoberg@adm.slu.se"
target=3D"_blank">karli.sjoberg@s=
lu.se</a></div>
</div>
<br></div><br>_______________________________________________<br>Users
mail=
ing list<br>Users@ovirt.org<br>http://lists.ovirt.org/mailman/listinfo/user=
s<br></blockquote><br></div></body></html>
------=_Part_32071891_1853162604.1345448307836--