HomeGuidesRecipesAPI
HomeGuidesAPILog In

Project Generation

The Project Generation REST API lives at /api/v1/client/generate/.

This API endpoint offers the client the ability to run the wizard in an automated non-UI fashion. Answer values can be supplied by answer files, data files, or label key/values. Some projects don't require additional values to be supplied and can be fully data-driven. In this case, the project can be run by just calling the API with a POST action without a body. Project generations are considered to be long-running regardless of the project itself. It is assumed the generation will take an unpredictable length of time and progress can be polled via the operations API.

For example:

  • https://server/produce/api/v1/client/generate/{guid}

Generate (no parameters)

Generates a form with no parameters (your project doesn’t require any additional answer values and can run unassisted).

Generate (with options)

All the generation variations take an optional options object. Available properties are:

  • version, used with projects published with the "Match project version when loading in progress forms". This project version will be the one generated.

  • generationDateTime, used with projects published with the "Match project version when loading in progress forms". The project version modified before or on this date will be the one generated. If both version and generationDateTime properties are supplied, version will be used.

  • log, generations are logged by default but to reduce server and DB load this value can be set to false.

Example of the request body for generating a form with options:

{
  "options": {
    "version": "4.3",
    "generationDateTime": "2017-07-04T00:59:28.238Z",
    "log": true
  }
}

Generate (with data)

To provide data files to the project supply them in an array of data objects.

  • dataServiceGuid, optional. When this value is not supplied Infiniti will look for the first data source in the project that matches the schema and uses that as the GUID. This can be expensive so it is recommended to supply the value if it is known.

  • value, JSON/XML encoded string or CSV containing the contents of the data file.

Example of the request body for generating a form with data with value in XML format. The main scenarios are for use when you have an XML Data Source in your project:

{
   "data":[
      {
         "dataServiceGuid":"4cdc9148-5496-4d38-ad97-739478f7fb",
         "value":"<Document><Row><field_01>John</field_01><field_02>Doe</field_02><field_03>True</field_03><field_04>18</field_04><field_05>Tester</field_05></Row><Row><field_01>Janie</field_01><field_02>Doe</field_02><field_03>False</field_03><field_04>20</field_04><field_05>Developer</field_05></Row></Document>"
      }
   ]
}
<Document>
   <Row>
      <field_01>John</field_01>
      <field_02>Doe</field_02>
      <field_03>True</field_03>
      <field_04>18</field_04>
      <field_05>Tester</field_05>
   </Row>
   <Row>
      <field_01>Janie</field_01>
      <field_02>Doe</field_02>
      <field_03>False</field_03>
      <field_04>20</field_04>
      <field_05>Developer</field_05>
   </Row>
</Document>

Example of the request body for generating a form with data with value in JSON format. The main scenarios are for use when you have a JSON Data Source in your project:

{
   "data":[
      {
         "dataServiceGuid":"a9e97e5b-58d1-48da-9853-d9714626f275",
         "value":"{\r\n  \"Data\": [\r\n    {\r\n      \"field_01\": \"John\",\r\n      \"field_02\": \"Doe\",\r\n      \"field_03\": \"True\",\r\n      \"field_04\": \"18\",\r\n      \"field_05\": \"Tester\"\r\n    },\r\n    {\r\n      \"field_01\": \"Janie\",\r\n      \"field_02\": \"Doe\",\r\n      \"field_03\": \"False\",\r\n      \"field_04\": \"20\",\r\n      \"field_05\": \"Developer\"\r\n    }\r\n  ]\r\n}"
      }
   ]
}
{
  "Data": [
    {
      "field_01": "John",
      "field_02": "Doe",
      "field_03": "True",
      "field_04": "18",
      "field_05": "Tester"
    },
    {
      "field_01": "Janie",
      "field_02": "Doe",
      "field_03": "False",
      "field_04": "20",
      "field_05": "Developer"
    }
  ]
}

Example of the request body for generating a form with data with value in CSV format. The main scenarios are for use when you have a CSV Data Source in your project:

{
   "data":[
      {
         "dataServiceGuid":"49626b76-2827-4576-8b65-4c6ef1e2457e",
         "value":"SN,American Samoa,Samoa américaine\r\nAT,Austria,Autriche"
      }
   ]
}
AS,American Samoa,Samoa américaine
AT,Austria,Autriche

Generate (with Answer File)

To generate the form with a pre-prepared answer file use the answerFile property.

Example of the request body for generating a form with a pre-prepared answer file:

{
   "answerFile":"<AnswerFile Version='2'><HeaderInfo><TemplateInfo TemplateGroupId='1068' TemplateGroupGuid='e13ef57f-c6f0-4a49-a612-06ed4cf44b4b' MergeToSingleDoc='False' RunId='0742c754-f459-42dc-9b5b-f49bf4c3bc81' FirstLaunchTimeUtc='2018-02-02T05:56:46.0207777Z' /><UserInfo UserId='1' UserGroupId='17' CreatorId='1' /></HeaderInfo><ps><p pid='00be97d8-607d-42dd-bab4-abc4c58a617b'><qs><q qid='5e21324a-e008-436a-990f-b88242f08be0'><as><a aid='e6bc82d1-b593-4437-a6c8-9db36a1ce32d' v='Janie' /></as></q><q qid='0f79a119-5de8-47e2-909d-7600ecb85a1f'><as><a aid='5d85f00a-f2bd-46da-bb6d-2731672ac55c' v='Doe' /></as></q></qs></p></ps></AnswerFile>"
}
<AnswerFile Version="2">
  <HeaderInfo>
    <TemplateInfo TemplateGroupId="1068" TemplateGroupGuid="e13ef57f-c6f0-4a49-a612-06ed4cf44b4b" MergeToSingleDoc="False" RunId="0742c754-f459-42dc-9b5b-f49bf4c3bc81" FirstLaunchTimeUtc="2018-02-02T05:56:46.0207777Z" />
    <UserInfo UserId="1" UserGroupId="17" CreatorId="1" />
  </HeaderInfo>
  <ps>
    <p pid="00be97d8-607d-42dd-bab4-abc4c58a617b">
      <qs>
        <q qid="5e21324a-e008-436a-990f-b88242f08be0">
          <as>
            <a aid="e6bc82d1-b593-4437-a6c8-9db36a1ce32d" v="Janie" />
          </as>
        </q>
        <q qid="0f79a119-5de8-47e2-909d-7600ecb85a1f">
          <as>
            <a aid="5d85f00a-f2bd-46da-bb6d-2731672ac55c" v="Doe" />
          </as>
        </q>
      </qs>
    </p>
  </ps>
</AnswerFile>

Generate (with labels: key/values)

For a lighter weight project, independent way of supplying values using the labels dictionary. Each property represents an answer file label name and its value. These values are turned into an answer file and applied to the form.

Example of the request body for generating a form with labels: key/values:

{
   "values":{
      "Answer1":"myValue1",
      "Answer2":"myValue2",
      "Answer3":"myValue3",
      "Answer4":"myValue4",
      "Answer5":"myValue5",
      "Answer6":"myValue6",
      "Answer7":"myValue7"
   }
}

Delayed Generate

To schedule a generation for a later time supply details for the schedule property.

  • name, a description of this generation that will appear in Manage

  • startDateTime, a date to begin this generation after.

Example of the request body for scheduling generation of a form:

{
   "schedule":{
      "startDateTime":"2017-07-04T00:59:28.239Z",
      "name":"This is a test for Infiniti REST API Delayed Generate"
   }
}

Generate (with Workflow)

To generate a form and at the same time define who will receive a workflow state after a transition is done, this can either be assigned to a specific user or a specific group.

  • comment, comment for the assignment to the next user.

  • sendToUserGuid, The user guid to assign the next state to.

  • sendToUserName, The username guid to assign the next state to.

  • sendToGroupGuid, The group guid to assign the next state to.

  • sendToGroupName, The group name to assign the next state to.

  • nextState, name of the next state the workflow will transition into.

Example of the request body for assigning the next state of a workflow to a specific user using either user guid or username:

{
   "workflow":{
      "comment":"This is a test for Infiniti REST API Generate with Workflow",
      "sendToUserName":"admin"
   }
}
{
   "workflow":{
      "comment":"This is a test for Infiniti REST API Generate with Workflow",
      "sendToUserGuid":"d1f7be9e-2fea-4fb9-9dcd-855b6ba2a7a0"
   }
}

Example of the request body for assigning the next state of a workflow to a specific group using either group guid or group name:

{
   "workflow":{
      "comment":"This is a test for Infiniti REST API Generate with Workflow",
      "sendToGroupName":"Tester"
   }
}
{
   "workflow":{
      "comment":"This is a test for Infiniti REST API Generate with Workflow",
      "sendToGroupGuid":"7fd8c5bc-51af-4442-9add-583315b649fd"
   }
}