Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DOC and version 7.1.0

Table of Contents

Resources

get

URL/api/v1/api.php?target=resource&action=get
DescriptionGet a resource or resources
ReturnsExamples:
SUCCESSFUL: {"success":1,"message":"Search successful","data":[{"id":"57","name":"2nd Email","slug":"
HTML
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

 

Table of Contents

Resources

get

URL/api/v1/api.php?target=resource&action=get
DescriptionGet a resource or resources
ReturnsExamples:
SUCCESSFUL: {"success":1,"message":"Search successful","data":[{"id":"57","name":"2nd Email","slug":"6c-contact-email2","type":"field","parent_id":"1","category_id":null,"attr":[]}]}
ERROR: {"success":0,"message":"Search failed"}:"field","parent_id":"1","category_id":null,"attr":[]}]}
ERROR: {"success":0,"message":"Search failed"}
Optional ParametersOptional Parameters

General Parameters:

NameTypeNotes/Example
nameSTRINGName of the resource. Example: 6Connect, Inc.
slugSTRINGThe unique URL friendly name of the resource. Example: 6connect-inc
typeSTRINGType of resource (eg. entry, field, category, dnsmodule)
searchSTRING

Search the resource system for the provided term. Performs a "LIKE" search to return similar results. Similar to GET Resource SEARCH call.

search_columnSTRINGColumn to perform a 'search' on.
permissions__trueSTRINGSet the permissions that must be true. Typically only used for UI / Gadget permissions.
permissions__falseSTRING

Set the permissions that must be false. Typically only used for UI / Gadget permissions.

getFromBackupINTEGERUse data from the resource_archive table instead of the standard resource table, used with "orig_id" identifying parameter.

Limit Results by ID:

At most, one of the following:

NameTypeNotes/Example
idINTEGERGet the resource which has this ID
orig_idINTEGERThe resource id from the standard resource table, used in conjunction with 'getFromBackup'.
custom_idINTEGERThe resource custom id provided by the user for the resource.
resource__inARRAY

Get any resource which has any of these IDs

Syntax: &resource__in[]=1771&resource__in[]=14238 (Each resource id you wish to search over gets its own phrase.)

resource__not_inARRAY

Get all the resources which do not have any of these IDs

Syntax: &resource__not_in[]=1771&resource__not_in[]=14238 (Each resource id you wish to exclude gets its own phrase.)

 

At most, one of the following:
NameTypeNotes/Example
parent_id
name
INTEGER
STRING
Get the resources whose parent has this ID
parent__inARRAY

Get any resource whose parents have any of these IDs.

Syntax: &parent__in[]=162&parent__in[]=299 (Each parent id you wish to search over gets its own phrase.)

parent__not_inARRAY

Get all resources whose parents do not have any of these IDs

Syntax: &parent__not_in[]=1771&parent__not_in[]=14238 (Each parent id you wish to exclude gets its own phrase.)

Name of the resource. Example: 6Connect, Inc.
slugSTRINGThe unique URL friendly name of the resource. Example: 6connect-inc
typeSTRINGType of resource (eg. entry, field, category)


 

At most, one of the following:

NameTypeNotes/Example
category_
idINTEGERGet the
resources of the category that
resource which has this ID
category
resource__inARRAY

Get any

resources whose categories have

resource which has any of these IDs

.

Syntax: &

category

resource__in[]=

11002

1771&

category

resource__in[]=

11003

14238 (Each

category

resource id you wish to search over gets its own phrase.)

category
resource__not_inARRAY

Get all the resources

of all the categories that

which do not have any of these IDs

Syntax: &

parent

resource__not_in[]=

11002

1771&

parent

resource__not_in[]=

11003

14238 (Each

category

resource id you wish to exclude gets its own phrase.)

Limit Results by Resource Link:

For resources for which exist a Resource Link, you may limit by resource link data


At most, one of the following:

NameTypeNotes/Example
resource_link_typeSTRING

The resource linkage relation name. Valid values include:

For type = dnsmodule:

Valid ValueNotes
dnsViewACLLinks a ACL and a Group. The View (Group) must be resource1, resource id and the ACL resource must be resource2 in the linkage table
dnsViewServerLinks a View (Group) with Server (DNS Connector), and the Group resource must be as resource1 and DNS Module as resource2. Used for attaching DNS servers to DNS Groups.
dnsZoneMasterLinks a DNS Zone resource with the Server that will be exported as Master. The DNS Zone must be in resource1 and the server as resource2. Used for Directly attaching zones to servers.
dnsZoneSlaveLinks a DNS Zone resource with the Server that will be exported as Slave. The DNS Zone must be in resource1 and the server as resource2. Used for Directly attaching zones to servers.
dnsZoneServer

Links a DNS Zone resource with a Server resource. The DNS Zone must be in resource1 and the server as resource2. Used to directly attach servers to zones.

dnsZoneViewLinks a DNS Zone resource with a Group. The DNS Zone must be resource1, the Group resource as resource 2.
resource_link_columnINTEGER

The column to be used for the parameter in "resource_link_value". Valid integer values are:

'1' = to use resource1 in the first column

'2' = to use resource2 in the second column

resource_link_valueINTEGERThe resource id for the resource_linkage table to search (Example: "10697")
parent_idINTEGERGet the resources whose parent has this ID
parent__inARRAY

Get any resource whose parents have any of these IDs.

Syntax: &parent__in[]=162&parent__in[]=299 (Each parent id you wish to search over gets its own phrase.)

parent__not_inARRAY

Get all resources whose parents do not have any of these IDs

Syntax: &parent__not_in[]=1771&parent__not_in[]=14238 (Each parent id you wish to exclude gets its own phrase.)


At most, one of the following:

NameTypeNotes/Example
category_idINTEGERGet the resources of the category that has this ID
category__inARRAY

Get any resources whose categories have any of these IDs.

Syntax: &category__in[]=11002&category__in[]=11003 (Each category id you wish to search over gets its own phrase.)

category__not_inARRAY

Get the resources of all the categories that do not have any of these IDs

Syntax: &parent__not_in[]=11002&parent__not_in[]=11003 (Each category id you wish to exclude gets its own phrase.)


You can set the order of the results by setting the STRING value of the parameter orderby to one of the following :

  • none
  • id
  • name (default)
  • slug
  • type
  • parent_id
  • date
  • resource__in (preserve order given in the resource__in array)


You can set the direction of the ordering of the results by setting the STRING value of the parameter order to one of the following :

  • ASC  (default)
  • DESC
Limit Results by Attributes:


You can further limit the results based on attributes the resources may have:

Name
TypeNotes/ExampleattributesARRAY

You can search on multiple attributes by including an array of attribute options:

var data = {
     "type: "entry",
     "attributes": [
          {
               "attr_key": "_section",
               "attr_value": "105",
          },
          {
               "attr_key": "address-mail-state",
               "attr_value": "CA",
          }
     ],
     "resources_per_page: 10
}
attr_keySTRINGThe name of the attribute. Example: network-fqdnattr_valueSTRINGThe value of any attribute, or if attr_key is specified, the value of the attribute defined in attr_key.attr_compareSTRING

If both attr_key and attr_value are given, the results are by default compared based on the value given as attr_value being equal to the value stored in the database. You can optionally change this by setting the STRING value of attr_compare to one of the following:

  • = (default)
  • !=
  • ﹥=
  • ﹤=
  • LIKE
  • NOT LIKE
  • IN
  • NOT IN
  • BETWEEN
  • NOT BETWEEN
    Note

    When attr_compare is set to IN, NOT IN, BETWEEN, NOT BETWEEN, then attr_value must either be an array or a comma separated string.

    TypeNotes/Example
    attr_keySTRINGThe name of the attribute. Example: network-fqdn
    attr_valueSTRINGThe value of any attribute, or if attr_key is specified, the value of the attribute defined in attr_key.
    attr_compareSTRING

    If both attr_key and attr_value are given, the results are by default compared based on the value given as attr_value being equal to the value stored in the database. You can optionally change this by setting the STRING value of attr_compare to one of the following:

    • =  (default)
    • !=
    • ﹥=
    • ﹤=
    • LIKE
    • NOT LIKE
    • IN
    • NOT IN
    • BETWEEN
    • NOT BETWEEN
    Note

    When attr_compare is set to IN, NOT IN, BETWEEN, NOT BETWEEN, then attr_value must either be an array or a comma separated string.


    You can search on multiple attributes by including an array of attribute options:

    NameTypeNotes/Example
    attributesARRAY
    var data = {
         "type: "entry",
         "attributes": [
              {
                   "attr_key": "_section",
                   "attr_value": "105",
              },
              {
                   "attr_key": "address-mail-state",
                   "attr_value": "CA",
              }
         ],
         "resources_per_page: 10
    }
    attr_loadBOOL

    Load resource attributes along with the resource entry

    Result Ordering:

    NameTypeNotes/ExampleorderSTRING

    Set the direction of the ordering of the results by ascending or descending order. Valid values are:

    • ASC  (default)
    • DESC
    orderbySTRING

    The parameter to order results by. Valid values include:

  • none
  • id
  • name (default)
  • slug
  • type
  • parent_id
  • date
  • resource__in (preserve order given in the resource__in array) Range Selection / Paging:


    You can restrict the range of the resources returned.

    NameTypeNotes/Example
    resources_per_pageINTEGERHow many resources to return
    per page, e
    .
    g.: '10' .
    offsetINTEGERHow many resources to offset
    from the initial resource, to use as the first resource provided in the return list
    (the initial resource is 0, not 1).
    pagedINTEGERThe page to return (starts at 1, not 0). This parameter is provided for convenience and is used to calculate the offset where: offset=(paged-1)*resources_per_page
    Example URL/api/v1/api.php?target=resource&action=get&id=7

    ...

    update

    URL/api/v1/api.php?target=resource&action=update
    DescriptionUpdate a resource.
    Returns

    Examples:
    SUCCESSFUL: {"success":1,"message":"Resource Updated","data":{"id":"1055","name":"87-child-1","slug":"87-child-1","type":"entry","parent_id":"87","category_id":"65","attr":{"_section":"70"},"section":{"id":"70","name":"Firewall","slug":"firewall","type":"section","parent_id":"1","category_id":null,"attr":{}}}}

    ERROR: {"success":0,"message":"No resource found with ID: 1079"}

    Required Parameters
    NameTypeNotes/Example
    meta[id]INTEGERID of resource
    meta[type]STRINGType of resource (entry, section, field, ect)

    Optional Parameters

    (meta[type] = entry)

    NameTypeNotes/Example
    fields[]ARRAYSee "add" documentation

    Optional Parameters

    (meta[type] = section)

    NameTypeNotes/Example
    fields[]ARRAY

    The fields value should be all the fields that are assigned to the section. Giving an empty array as the fields value will remove all fields from the section.

    The format is:

    fields[position][key]

    The position value is the position that the field will appear in (0 is first). The position value must always be included. An example field format for an existing field could be:

    fields[0][id]=2
    fields[0][slug]=asset-serial-number
    fields[0][help_block]=something
    fields[0][new]=false

    • Either the id or the slug is required, not both.
    • When the "new" parameter is not included, FALSE is assumed

    If you want to create a new field and assign it to the section, use a format like this:

    fields[10][name]=TextArea
    fields[10][field_type]=textarea
    fields[10][new]=true 


    delete

    URL/api/v1/api.php?target=resource&action=delete
    DescriptionDelete a resource.
    ReturnsExamples:
    SUCCESSFUL: {"success":1,"message":"Resource deleted."}
    ERROR: {"success":0,"message":"No resource found with ID: 57"}
    Required Parameters
    NameTypeNotes/Example
    idINTEGERID of the resource
    Optional Parameters
    NameTypeNotes/Example
    recursiveBOOLWhen 1, deletes parent and child entries for the resource

    A recursive delete will delete all resources, which are permitted to be deleted, from the bottom up.

    Imagine the following hierarchy:

    Code Block
                 A
        B1                B2
    C11    C12        C21    C22

    If a recursive delete is performed on A, but C21 is not deletable, the following

    resources would still be deleted: (B1, C11, C12, C22).

    B2 would not be deleted because it depends on C21 and A would not be deleted because it depends on B2. 


    Example URL/api/v1/api.php?target=resource&action=delete&id=57

    ...

    get resource search

    Description

    Search the resource system for the provided term. Performs a "LIKE" search to return similar results.

    URL/api/v1/api.php?target=resource&action=get&search=
    Returns

    Examples:

    SUCCESSFUL:{"success":1,"message":"Search successful","data":[{"id":"11011","name":"a6connectchildentry","slug":"a6connectchildentry","type":"entry","parent_id":"4210","category_id":null,"date":1499106555,"modified":1499106555,"attr":{"_section":"4214"},"section":{"id":"4214","name":"aQA Section","slug":"aqa-section","type":"section","parent_id":"1","category_id":null,"date":1498775688,"modified":1499106630,"attr":[]},"gadgets":[]}],"result_count":1,"found_count":1}
    ERROR:{"success":0, "message":"error message"}

    Return Detail:

    NameTypeDescription
    idINTEGERId of the resource linkage
    nameSTRINGThe resource name
    slugSTRINGThe resource slug
    typeSTRINGThe resource type.
    parent_idINTEGERID of the parent resource
    category_idINTEGERID of the resource category type
    dateINTEGERResouce creation date
    modifiedINTEGERResource last modified date
    attrJSONA JSON list of resource attributes
     


    Required Attributes:

    NameTypeDescription
    searchSTRINGThe search term
    Example URL/api/v1/api.php?target=resource&action=get&search=6connect