Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Add

URL/api/v1/api.php?target=lir&action=add
Description

Adds a new LIR.

LIR creation utilizes the Resource system - see API Module - Resource - Add for details on adding a resource via the API.

Returns

Examples:

SUCCESSFUL
{
    "success":1,
 "message":"Resource added",
 "data":
 {
 "id":14063,
 "name":"TestLIR",
 "slug":"testlir",
 "type":"entry",
 "parent_id":1,
 "category_id":null,
 "date":1517513319,
 "modified":1517513319,
 "attr":
 {
 "_section":"94",
 "rir":"ARIN",
 "asn":"20202",
 "org-handle":"org1",
 "admin-poc":"admin1",
 "net-poc":"tech1",
 "abuse-poc":"abuse1",
 "net-name-prefix":"test-",
 "api-key":10,
 "mnt-by":"",
 "admin-c":"",
 "tech-c":"",
 "_gadget_data":false
 },
 "section":
 {
 "id":"94",
 "name":"LIR",
 "slug":"lir",
            "type":"section",
            "parent_id":"1",
            "category_id":null,
            "date":1375846025,
            "modified":1375846025,
            "attr":[]
         },
         "gadgets":false   
    }
}
					
ERROR
{
    "success":0,
    "message":"error message"
}
				

Required Parameters

( meta[ ] =)

Name
Type
Example
Notes
meta[name]STRINGTestLIRName of the new LIR resource.
meta[type]STRINGentryType of resource - Adding a LIR will always be "entry".
meta[section]STRINGlirSection of the resource object. - Adding a LIR will always have "lir" as the section.
Fields Information
Detail on the "fields" array:
fields[]ARRAY

Entry field values (for fields that have already been assigned to the section) can be populated when the entry is created.

The format is field[field-slug][field-instance]. If the field instance is left blank, it will simply be the next value in the instance array. For example:

fields[network-fqdn][]=example.com&fields[network-fqdn][]=test.com

would be written in JSON as

var fields = {
     "network-fqdn": [
          "example.com",
          "test.com"
     ]
}

Please note that the Field Slug might differ from the Field Name! To find the correct slug to use in adding resources with field values go the Section of the Resource you are adding, click 'Edit', then click the name of the Fields you will be populating. An Edit Field box will pop up which displays the Field's slug.

A field can be added to a section multiple times. The field instance is used to keep track of which field occurrence we are referring. In this example, the network-fqdn field had been added twice to the section so we were able to store two values for it.

Required Parameters

( fields[ ][] =)

Name
Type
Example
Notes
fields[rir][]STRINGARINThe RIR for the LIR. Accepted values are "ARIN", "RIPE", "LACNIC", "AfriNIC", "APNIC", and "1918".
fields[asn][]STRING20202The ASN (Autonomous System Number) for the LIR.

Optional Parameters

( fields[ ][] =)

For LIRs with RIR = "ARIN":
Name
Type
Example
Notes
fields[org-handle][]       STRINGorg1Organization Handle 
fields[admin-poc][]STRINGadmin1The admin point of contact object name.
fields[technet-cpoc][]STRINGtech1Technical The network point of contact for this object.
fields[abuse-poc][]STRINGabuse1The abuse point of contact object name.
fields[net-name-prefix][]STRINGtest-The network name prefix.
fields[api-key][]STRINGakakakakakakaAPI key used to interface with RIR services

 

 

For LIRs with RIR = "RIPE", "LACNIC", "AfriNIC", "APNIC", and "1918". :
Name
Type
Example
Notes
fields[mnt-by][]STRINGmaint1The name of the maintainer object.
fields[mnt-by-password][]STRINGpasswordabcdThe maintainer password.
fields[admin-c][]STRINGadmin1Administrative contact for this object.
fields[tech-c][]STRINGtech1Technical contact for this object

 

 

Example URL

ARIN example with only minimum required information:

/api/v1/api.php?target=lir&action=add&meta[name]=TestLIR1&meta[type]=entry&meta[section]=lir&fields[rir][]=ARIN&fields[asn][]=20202

ARIN example with full Organization field details:

/api/v1/api.php?target=lir&action=add&meta[name]=TestLIR2&meta[type]=entry&meta[section]=lir&fields[rir][]=ARIN&fields[asn][]=20202&fields[org-handle][]=org1&fields[admin-poc][]=admin1&fields[net-poc][]=tech1&fields[abuse-poc][]=abuse1&fields[net-name-prefix][]=test-&fields[api-key][]=akakakakakaka

 

Non-ARIN example with only minimum required information:

/api/v1/api.php?target=lir&action=add&meta[name]=TestLIR3&meta[type]=entry&meta[section]=lir&fields[rir][]=RIPE&fields[asn][]=20202

Non-ARIN example with full Organization field details:

/api/v1/api.php?target=lir&action=add&meta[name]=TestLIR4&meta[type]=entry&meta[section]=lir&fields[rir][]=1918&fields[asn][]=20202&fields[mnt-by][]=maint1&fields[mnt-by-password][]=passwordabcd&fields[admin-c][]=admin1&fields[tech-c][]=tech1

...