API

common.lookup.list

From GoGrid



Contents

This is an API method to list options and lookups. To list all the available lookups, set the parameter lookup to lookups. With this list you can then list all the options for a particular lookup, by setting lookup to the particular lookup's id or name. This method follows a common list pattern.


Request

URL


Role Based Access Control Permissions

  • Super User
  • System User
  • Billing User
  • Read Only User

Input Request Query Parameters

Required Name Version Type Description
Required api_key 1.0 string An API Key generated by GoGrid.
  sig 1.0 string An MD5 Signature that signs each and every API request. Instructions on how to generate this signature can be found here.
v 1.0 string The version of the API. For more information, see API Versions.
  • For version 1.3, set parameter to 1.3
  lookup string The lookup to be listed. This can be a int or string representing the lookup's id or name respectively.
  • To list the entire list of available lookups, set parameter to lookups.
Optional sort 1.0 string Sort based on the option's id, name, or description attributes. Valid values are:
  • To sort by the option's id set parameter to id.
  • To sort by the option's name set parameter to name.
  • To sort by the option's description set parameter to description.
  • Used in conjunction with asc.
  asc 1.0 string Ascending or descending sort on attribute specifed by sort.
  • To sort ascending (1,2,3), on the sort set parameter to any the following values asc, true, 1.
  • To sort descending (3,2,1), on the sort attribute set to either desc, false, or 0.
  • Ignored if sort isn't set.
  • Default is true.

Sample Request

To list available lookups with an ascending sort by name:

https://api.gogrid.com/api/common/lookup/list
  ?lookup=lookups
  &sort=name
  &asc=true
  ... auth parameters...


Response

A common list response of Options. The list is based on which lookup was input in the lookup parameter.

JSON Response

[
   {
      "status":"success",
      "method":"/common/lookup/list",
      "list":[
         {
            "object":"option",
            "description":"Server with 512MB RAM",
            "name":"512MB",
            "id":1
         },
         {
            "object":"option",
            "description":"Server with 1GB RAM",
            "name":"1GB",
            "id":2
         },
         {
            "object":"option",
            "description":"Server with 2GB RAM",
            "name":"2GB",
            "id":3
         }
      ],
      "summary":{
         "total":3,
         "start":0,
         "returned":3
      }
   }
]

XML Response

<gogrid>
  <response method="/common/lookup/list" status="success">
    <summary total="3" start="0" returned="3"/>
    <list>
      <object name="option">
        <attribute name="id">1</attribute>
        <attribute name="name">512MB</attribute>
        <attribute name="description">Server with 512MB RAM</attribute>
      </object>
      <object name="option">
        <attribute name="id">2</attribute>
        <attribute name="name">1GB</attribute>
        <attribute name="description">Server with 1GB RAM</attribute>
      </object>
      <object name="option">
        <attribute name="id">3</attribute>
        <attribute name="name">2GB</attribute>
        <attribute name="description">Server with 2GB RAM</attribute>
      </object>
    </list>
  </response>
</gogrid>

CSV Response

# SUCCESS, /common/lookup/list, TOTAL, 3, START, 0, RETURNED, 3
# id,name,description
1,512MB,Server with 512MB RAM
2,1GB,Server with 1GB RAM
3,2GB,Server with 2GB RAM

Error Codes

Status Code Description
400 IllegalArgumentException Any problems with input parameters will generate an IllegalArgumentException.
401 Unauthorized This error code will occur when the role tied to the API Key in your request has the wrong Access Controls.
403 Authentication Failed This error code will occur when your request is not properly signed. Make sure your have a valid API key and secret and that you are properly generating a request signature. Ensure that the clock on the computer from which you are making the request is synchronized woth the GoGrid API Server.
404 Not Found This error will occur if you have specified a method that does not exist or any other URL does not exists on the API Server.
500 UnexpectedError These types of errors indicate an internal system problem. Depending on the severity of the error and whether not it is blocking your development, report the error to GoGrid support by emailing the response to apisupport@gogrid.com.
Personal tools