Logo.CortexAG

Anmelden +

Beispiel einer Portalliste

import urllib2
import json


###  url to call the dataservice in the right database
url = "http://localhost/i/UniPlexDataservice/updjsr.php"

### Request-ID to identitfy the right returned json object
requestID = 1

### Begin: User-Handle

### Setting headers for dataservice api
headers = {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
}

### data object to request the user login for the dataservice
data = {
    "method" :  "getLogin",
    "requestid" : requestID,
    "param" : {
        "user": 'admin',
        "pass": "admin",
        "app": "UniplexDataservice"
    }
}

# Build POST data
postdata = json.dumps(data).encode()

# Create request object
req = urllib2.Request(url, postdata, headers)

# Send request
f = urllib2.urlopen(req)
ret = json.loads(f.read())

UsrHdl = ret['result']['data']['UpdJsrHdl']

### End: User-Handle

### Begin: portal list call

data = {
    "method" :  "getPortalRowListData",
    "requestid" : requestID,
    "param" : {
        "portal": 'Schulung-einfach',
        "UpdJsrHdl": UsrHdl,
        "group": "Teile",
        "row": "Typen"
    }
}

postdata = json.dumps(data).encode()
req = urllib2.Request(url, postdata, headers)

f = urllib2.urlopen(req)
ret = json.loads(f.read())

### End: portal list call

### print result
print ret

 

 Hinweise zur Online-Hilfe
 

© 2017 Cortex AG
(letzte Aktualisierung: 12.04.2017)

 Haftungsausschluss 

Impressum    AGB