i just started working with Opsi, jQuery and Json but i´ll try to give you all the information you need and please bear with me if my coding is not the best.
My Problem is:
I want to setup some kind of "Kiosk" for Opsi (on a different webserver - so it's cross-domain), where all users can indiviually install and update Applications.
For this i need information about the Users Computer, like: What Software is already installed, which is outdated etc.
Now i want to send a Request to "https://myopsiserver:4447/rpc?" that gives me a response i can work with.
I use jQuery and Ajax to send a xmlHttp-Request but all i get is this response:
Code: Alles auswählen
{"result": null, "id": null, "error": {"message": "Opsi bad rpc error: Failed to decode rpc: No JSON object could be decoded", "class": "OpsiBadRpcError"}}
Request-Headers:
Code: Alles auswählen
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: de,en-US;q=0.7,en;q=0.3
Authorization: Basic YWhvZWZmbmVyOkxiNTZ1QWgxOTI=
Connection: keep-alive
Cookie: OPSISID=ReAV5EJdTTuE1bHg2L0nR9p704jms5hD
Host: myopsiserver:4447
Referer: http://someotherserver/opsikiosk/index.php
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Code: Alles auswählen
Content-Length: 155
Content-Type: text/html;charset=utf-8
Date: Wed, 21 Sep 2016 12:01:44 GMT
Server: Twisted/12.0.0 TwistedWeb/[OPSI.web2, version 0.2.0]
Set-Cookie: OPSISID=dvlzsFYZRkahKUmD5xP96o9W7sWgtJDB; path=/
The user and the pass are submitted at another location, but my Opsi-Credentials are working fine with https://myopsiserver:4447/interface?.
So it can't be an error there.
But i'm not sure if everything else is like it should be.
Code: Alles auswählen
$.ajax({
url: 'https://myopsiserver:4447/rpc?',
jsonp: "callback",
dataType : 'jsonp',
data: {
"id": "1",
"method": "getInstalledLocalBootProductIds_list",
"params": ["EnterValidPcNameHere"]
},
beforeSend: function(xhr){
xhr.setRequestHeader("Authorization", "Basic " + btoa(user + ":" + pass));
},
sucess: function(result) {
alert('done');
}
});
Like i said, this stuff is new for me and i can't find a proper documentation for the RPC.
I hope someone can help me and maybe explain some things.