company logo

Create new instance by OSI function

Creating new instances requires identifying key components in many cases, which have to be provided by the request. Sometimes, as for PersonI:pid, key component values may be created by a function. In such cases, one may also create new instances by calling an OSI function.

Create

In order to create a new instance, the following PUT request (query) could be defined (the field mapping is similar to an OSI request, but the query type differs):

Class/type

Query/variable

Source

Comment

Person/OSI

NewPerson

Persons

Create new person in Persons collection

    result

CreateNew(

?name,

?firstname,

?birthdate,

?married)

Family name, first name and birsth date for person to be created. Person'd identifier is created automatically by called function.

In order to assign values to the field names mapped, parameters with the same name have to be passed with the query HTTP GET request: The POST request generated from this mapping contains variable names preceded with '?'.

Test: http://localhost:2000/query/OSI/Person/NewPerson?name="Miller"&

      firstname=Paul&birthdate="1.1.1999"&married=true

POST

user

pwd

/osi

Persons ==> {

  result : CreateNew(?name,?firstname,?birthdate,?married) }

Result

The function result is returned as result value according to the mapping:

{ Persons: { result: true } }