API idgen - RapturePlatform/Rapture GitHub Wiki

IdGen API

A idGen is a unique number generator - once defined it can be used to create unique ids that can be attached to documents or entities. idGens can be attached to a document repository so that new documents created in that repository can optionally have unique ids.

getIdGenConfigs

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
List<RaptureIdGenConfig> retVal = idgenApi.getIdGenConfigs(authority);
retVal = baseAPI.doIdGen_GetIdGenConfigs(authority);

Entitlement: /admin/idgen

Gets a list of idGens that have the given authority. Each idGen has a URI, and the authority is part of the URI. idGens whose URIs have an authority that matches the passed parameter will be returned.

Function Parameters

Parameter Type Description
authority String

Return value

Type Description
List

getIdGenConfig

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
RaptureIdGenConfig retVal = idgenApi.getIdGenConfig(idGenUri);
retVal = baseAPI.doIdGen_GetIdGenConfig(idGenUri);

Entitlement: /admin/idgen

Retrieves a single idGen config given its name.

Function Parameters

Parameter Type Description
idGenUri String

Return value

Type Description
RaptureIdGenConfig
Types used in this function

RaptureIdGenConfig

Holds the config info for a idgen as described in the idgen API.

Field Type
name String
config String
authority String

createIdGen

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
RaptureIdGenConfig retVal = idgenApi.createIdGen(idGenUri, config);
retVal = baseAPI.doIdGen_CreateIdGen(idGenUri, config);

Entitlement: /admin/idgen

This method is used to define a new idGen in a given authority. The config parameter defines the storage to be used for managing the idGen.

Function Parameters

Parameter Type Description
idGenUri String
config String

Return value

Type Description
RaptureIdGenConfig
Types used in this function

RaptureIdGenConfig

Holds the config info for a idgen as described in the idgen API.

Field Type
name String
config String
authority String

idGenExists

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
boolean retVal = idgenApi.idGenExists(idGenUri);
retVal = baseAPI.doIdGen_IdGenExists(idGenUri);

Entitlement: /admin/idgen

Returns true if the idGen was found.

Function Parameters

Parameter Type Description
idGenUri String

Return value

Type Description
boolean

deleteIdGen

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
void retVal = idgenApi.deleteIdGen(idGenUri);
retVal = baseAPI.doIdGen_DeleteIdGen(idGenUri);

Entitlement: /admin/idgen

This method is used to delete a previously defined idGen.

Function Parameters

Parameter Type Description
idGenUri String

Return value

Type Description
void

setIdGen

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
void retVal = idgenApi.setIdGen(idGenUri, count);
retVal = baseAPI.doIdGen_SetIdGen(idGenUri, count);

Entitlement: /admin/idgen

This method can be used to reset an idGen to a new id - all future requests will start from this new point.

Function Parameters

Parameter Type Description
idGenUri String
count Long

Return value

Type Description
void

next

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
String retVal = idgenApi.next(idGenUri);
retVal = baseAPI.doIdGen_Next(idGenUri);

Entitlement: /admin/idgen

This method is used to increment the idGen and returns a string that corresponds to the newly generated id.

Function Parameters

Parameter Type Description
idGenUri String

Return value

Type Description
String

nextIds

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
String retVal = idgenApi.nextIds(idGenUri, num);
retVal = baseAPI.doIdGen_NextIds(idGenUri, num);

Entitlement: /admin/idgen

This method is used to increment the idGen by given amount and returns a string that corresponds to the newly generated id.

Function Parameters

Parameter Type Description
idGenUri String
num Long

Return value

Type Description
String

setupDefaultIdGens

HttpIdGenApi idgenApi = new HttpIdGenApi(loginApi);
void retVal = idgenApi.setupDefaultIdGens(force);
retVal = baseAPI.doIdGen_SetupDefaultIdGens(force);

Entitlement: /admin/lock

Sets up any idGens needed by Rapture by default, should be called from any startup scripts. If force is set to true, it will force the configto be set up again, even if it already exists.

Function Parameters

Parameter Type Description
force boolean

Return value

Type Description
void
⚠️ **GitHub.com Fallback** ⚠️