Subversion Repositories oidplus

Rev

Rev 1292 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
635 daniel-mar 1
<!DOCTYPE HTML>
2
<html>
3
 
4
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
5
 
6
<script>
7
 
8
// This is an example script that shows how you can insert an OID
9
// (in this example "2.999.123") using an authenticated AJAX query ("RPC"-like)
10
 
11
function testInsertOID() {
12
        $.ajax({
13
                url:"<url>",
14
                method:"POST",
15
                data:{
16
                        plugin:"1.3.6.1.4.1.37476.2.5.2.4.1.0", // OID of plugin "publicPages/000_objects"
17
                        action:"Insert",
18
                        parent:"oid:2.999",
19
                        id:123,
20
                        ra_email:"test@example.com",
21
                        comment:null,
22
                        asn1ids:"aaa,bbb,ccc",
23
                        iris:null,
24
                        confidential:false,
25
                        weid:null,
26
                        OIDPLUS_AUTH_JWT:"<token>"
27
                },
28
                error:function(jqXHR, textStatus, errorThrown) {
29
                        alert("Error: " + errorThrown);
30
                },
31
                success:function(data) {
1447 daniel-mar 32
                        if (typeof data === "object" && "error" in data) {
33
                console.error(data);
635 daniel-mar 34
                                alert("Error: " + data.error);
1447 daniel-mar 35
            } else if (typeof data === "object" && "status" in data && data.status >= 0/*OK*/) {
36
                alert("Insert OK");
37
            } else if (typeof data === "object" && "status" in data && data.status < 0) {
38
                console.error(data);
39
                alert("Error: " + data.status);
635 daniel-mar 40
                        } else {
1447 daniel-mar 41
                console.error(data);
635 daniel-mar 42
                                alert("Error: " + data);
43
                        }
44
                }
45
        });
46
}
47
 
48
</script>
49
 
50
<body>
51
 
52
<input type="button" onclick="testInsertOID()" value="Insert 2.999.123 to database">
53
 
54
</body>
55
 
56
</html>