195 | | == API Method Conventions == |
196 | | |
197 | | Each Registry and Authority manages the state of or access to objects. Some conventions apply to similar methods across Registry or Authority services. |
198 | | |
199 | | ''' Create_*Method ''' : Creates a new instance of the given object with a ‘fields’ option specifying particular field values that are to be associated with the object. These may only include those fields specified as ‘ALLOWED or ‘REQUIRED’ in the ‘Creation’ column of the object descriptions below or in the “CREATE’ key in the supplemental fields in the get_version specification for that object. If successful, the call returns a dictionary of the fields associated with the newly created object. |
200 | | |
201 | | ''' Update_* Method ''' : Updates an object instance specified by URN with a ‘fields’ option specifying the particular fields to update. Only a single object can be updated from a single update call. The fields may include those specified as ‘Yes’ in the ‘Update’ column of the object descriptions below, or ’TRUE’ in the ‘UPDATE’ key in the supplemental fields provided by the get_version call. Note: There may be more than one entity of a given URN at an authority, but only one ‘live’ one (any other is archived and cannot be updated). |
202 | | |
203 | | ''' Lookup_* Method ''' : This call takes a set of ‘match’ criteria provided in the ‘options’ field, and returns a dictionary of dictionaries of object attributes keyed by object URN matching these criteria. If a ‘filter’ option is provided, only those attributes listed in the ‘filter’ options are returned. The requirements on match criteria supported by a given service are service-specific; however it is recommended that policies restrict lookup calls to requests that are bounded to particular sets of explicitly listed objects (and not open-ended queries). |
204 | | |
205 | | Specifically, the options argument to the lookup_* call is a dictionary. It contains an entry with key ‘match’ that contains a dictionary of name/value pairs. The names are of fields listed in the get_version for that object. The values are values for those fields to be matched. The semantics of the match is to be an “AND” (all fields must match). |
| 195 | == Standard API Method == |
| 196 | |
| 197 | Each Registry and Authority manages the state of or access to objects. There are some standard methods that apply to standard operations on objects of specific types. All services support the following API's for the object types that are required or provided in get_version. |
| 198 | |
| 199 | {{{ |
| 200 | #!python |
| 201 | # Creates a new instance of the given object with a ‘fields’ option specifying particular field values that are to be associated with the object. |
| 202 | # These may only include those fields specified as ‘ALLOWED or ‘REQUIRED’ in the ‘Creation’ column of the object descriptions below |
| 203 | # or in the “CREATE’ key in the supplemental fields in the get_version specification for that object. |
| 204 | # If successful, the call returns a dictionary of the fields associated with the newly created object. |
| 205 | # |
| 206 | # |
| 207 | # Arguments: |
| 208 | # |
| 209 | # type : type of object to be created |
| 210 | # options: |
| 211 | # 'fields', a dictionary field/value pairs for object to be created |
| 212 | # |
| 213 | # Return: |
| 214 | # Dictionary of field/value pairs for created slice (e.g. slice URN, slice UUID, expiration and slice credential) |
| 215 | # |
| 216 | # Should return DUPLICATE_ERROR if creating a slice for which a non-expired slice of same name exists. |
| 217 | def create(type, credentials, options) |
| 218 | }}} |
| 219 | |
| 220 | {{{ |
| 221 | #!python |
| 222 | # Updates an object instance specified by URN with a ‘fields’ option specifying the particular fields to update. |
| 223 | # Only a single object can be updated from a single update call. The fields may include those specified as ‘Yes’ in the ‘Update’ column |
| 224 | # of the object descriptions below, or ’TRUE’ in the ‘UPDATE’ key in the supplemental fields provided by the get_version call. |
| 225 | # Note: There may be more than one entity of a given URN at an authority, but only one ‘live’ one (any other is archived and cannot be updated). |
| 226 | # |
| 227 | # Arguments: |
| 228 | # type: type of object to be updated |
| 229 | # urn: URN of object to update |
| 230 | # |
| 231 | # Options: Contains ‘fields’ key referring dictionary of name/value pairs to update |
| 232 | # Return: None |
| 233 | # |
| 234 | def update(type, urn, credentials, options) |
| 235 | }}} |
| 236 | |
| 237 | {{{ |
| 238 | #!python |
| 239 | # Deletes an object instance specified by URN |
| 240 | # Only a single object can be deleted from a single update call. |
| 241 | # Note: not all objects can be deleted. In general, it is a matter of authority policy. |
| 242 | # |
| 243 | # Arguments: |
| 244 | # type: type of object to be deleted |
| 245 | # urn: URN of object to delete |
| 246 | # |
| 247 | # Return: None |
| 248 | # |
| 249 | def delete(type, urn, credentials, options) |
| 250 | }}} |
| 251 | |
| 252 | {{{ |
| 253 | #!python |
| 254 | # Lookup requested details for objects matching ‘match’ options. |
| 255 | # This call takes a set of ‘match’ criteria provided in the ‘options’ field, and returns a dictionary of dictionaries of object attributes keyed by object URN matching these criteria. |
| 256 | # If a ‘filter’ option is provided, only those attributes listed in the ‘filter’ options are returned. |
| 257 | # The requirements on match criteria supported by a given service are service-specific; |
| 258 | # however it is recommended that policies restrict lookup calls to requests that are bounded to particular sets of explicitly listed objects (and not open-ended queries). |
| 259 | # |
| 260 | # |
| 261 | # Arguments: |
| 262 | # type: type of objects for which details are being requested |
| 263 | # options: What details to provide (filter options) for which slices (match options) |
| 264 | # |
| 265 | # Return: List of dictionaries (indexed by object URN) with field/value pairs for each returned object |
| 266 | # |
| 267 | def lookup (type, credentials, options) |
| 268 | }}} |
| 269 | |
| 270 | Some additional details on the lookup call: |
| 271 | |
| 272 | The options argument to the lookup_* call is a dictionary. It contains an entry with key ‘match’ that contains a dictionary of name/value pairs. The names are of fields listed in the get_version for that object. The values are values for those fields to be matched. The semantics of the match is to be an “AND” (all fields must match). |