Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
635 | daniel-mar | 1 | #!/usr/bin/python |
2 | |||
3 | # This is an example script that shows how you can insert an OID |
||
4 | # (in this example "2.999.123") using an authenticated AJAX query ("RPC"-like) |
||
5 | |||
6 | # pip install requests |
||
7 | import requests |
||
8 | |||
9 | url = '<url>' |
||
10 | myobj = { |
||
11 | 'plugin': "1.3.6.1.4.1.37476.2.5.2.4.1.0", # OID of plugin "publicPages/000_objects" |
||
12 | 'action': "Insert", |
||
13 | 'parent': "oid:2.999", |
||
14 | 'id': 123, |
||
15 | 'ra_email': "test@example.com", |
||
16 | 'comment': None, |
||
17 | 'asn1ids': "aaa,bbb,ccc", |
||
18 | 'iris': None, |
||
19 | 'confidential': False, |
||
20 | 'weid': None, |
||
21 | 'OIDPLUS_AUTH_JWT': "<token>" |
||
22 | } |
||
23 | |||
24 | json = requests.post(url, data = myobj).json() |
||
25 | |||
26 | if json['error'] != None: |
||
27 | print(json['error']); |
||
28 | elif json['status'] == 0: # OK |
||
29 | print("Insert OK"); |
||
30 | elif json['status'] == 1: # RaNotExisting |
||
31 | print("Insert OK"); |
||
32 | elif json['status'] == 2: # RaNotExistingNoInvitation |
||
33 | print("Insert OK"); |
||
34 | else: |
||
35 | print("Error "+json); |