Versions Compared

    Key

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

    ...

    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"}
    Optional 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)

     

    At most, one of the following:

    NameTypeNotes/Example
    idINTEGERGet the resource which has this ID
    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_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

    the

    any resources

    of the

    whose categories

    that

    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

     

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

    NameTypeNotes/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
    }

     

    You can restrict the range of the resources returned.

    NameTypeNotes/Example
    resources_per_pageINTEGERHow many resources to return.
    offsetINTEGERHow many resources to offset (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

    ...