Content deleted Content added
No edit summary |
m change source to syntaxhighlight |
||
Line 13:
To load this module from Lua modules, use:
<
local querySensitiveIPs = require('Module:Sensitive IP addresses/API').query
</syntaxhighlight>
The query function is called with named parameters. For example:
<
local result = querySensitiveIPs{
test = {'1.2.3.4', '5.6.7.8'}
}
</syntaxhighlight>
== Parameters ==
Line 41:
The top level object contains exactly one child object. If the query executed successfully, this object has a key of <code>sensitiveips</code> and contains the query results.
<
{
"sensitiveips": {
Line 47:
}
}
</syntaxhighlight>
If there were any errors when executing the query, the child of the top-level object has a key of <code>error</code> and contains error information. The error object has three keys: <code>code</code>, the error ID; <code>info</code>, the error message; and <code>*</code>, a message about where to find the API documentation. The error IDs all have a prefix of "sipa". For example:
<
{
"error": {
Line 59:
}
}
</syntaxhighlight>
=== Sensitive IPs object ===
Line 105:
Query:
<
querySensitiveIPs{
test = {'1.2.3.4'}
}
</syntaxhighlight>
Result:
<
{
["sensitiveips"] = {
}
}
</syntaxhighlight>
=== One match ===
Query:
<
querySensitiveIPs{
test = {'156.33.5.76'}
}
</syntaxhighlight>
Result:
<
{
["sensitiveips"] = {
Line 168:
},
}
</syntaxhighlight>
=== One match, JSON output ===
Line 174:
Query:
Query:
<
querySensitiveIPs{
format = 'json',
test = {'156.33.5.76'}
}
</syntaxhighlight>
Result:
<
{
"sensitiveips":{
Line 221:
}
}
</syntaxhighlight>
=== Entity IDs ===
<
querySensitiveIPs{
format = 'json',
entities = {'usdhs', 'usdoj'}
}
</syntaxhighlight>
Result:
<
{
"sensitiveips": {
Line 264:
}
}
</syntaxhighlight>
=== Invalid IP error ===
Query:
<
querySensitiveIPs{
test = {'foo'}
}
</syntaxhighlight>
Result:
<
{
["error"] = {
Line 284:
}
}
</syntaxhighlight>
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
|