Table of Contents

Search

  1. Preface
  2. RulePoint Interfaces
  3. RulePoint Services
  4. Custom Service API
  5. Java Adapter for REST API
  6. RulePoint REST API
  7. Sample XML and JSON Requests and Responses
  8. RulePoint Pluggable Authentication Module
  9. HTTP Request and Response Attributes

Developer Guide

Developer Guide

Create SQL Source

Create SQL Source

Use the POST method to create an SQL source in RulePoint.

POST Request in JSON Format

Generate a POST request. For example, the following POST request creates an SQL source in a RulePoint application:
POST http://localhost:8080/rulepoint/api/projects/1/responses/11780430-b441-4a03-9733-b2c429d15c45 Accept: application/json Content-Type: application/json Cookie: JSESSIONID=<VALID SESSION ID>

POST Body in JSON Format

{ "name": "SqlSource1", "valid": true, "type": "sources", "topics": [ { "rel": "topics", "href": "api/projects/4/topics/e1accb9c-b1a0-431b-b771-bc7662811e95", "title": "SqlTopic1", "id": "e1accb9c-b1a0-431b-b771-bc7662811e95" } ], "connection": { "rel": "connection", "href": "api/projects/4/connections/1d559d37-2c6e-48c0-8623-c571339c1e99", "title": "SqlConnection1", "id": "1d559d37-2c6e-48c0-8623-c571339c1e99" }, "sourceType": "SqlSource", "config": { "sql": "select * from stock where price < 20", "propertyMetadataMap": "[\"java.util.HashMap\",{}]", "parameters": "", "transactionSize": 0, "bufferResult": "no" }, "marshaller": { "marshallerProperties": {}, "marshallerThreadsafe": false } }

POST Response in JSON Format

Returns the SQL source object and response code. Returns the error object if an error occurs.
{ "id": "b40f59c8-01c8-4202-bb0c-8dd0fb3a93f6", "name": "SqlSource1", "valid": false, "self": { "rel": "self", "href": "api/projects/4/sources/b40f59c8-01c8-4202-bb0c-8dd0fb3a93f6", "title": "SqlSource1", "id": "b40f59c8-01c8-4202-bb0c-8dd0fb3a93f6" }, "actions": [ { "rel": "update", "href": "api/projects/4/sources/b40f59c8-01c8-4202-bb0c-8dd0fb3a93f6", "type": "PUT", "title": "Edit" }, { "rel": "delete", "href": "api/projects/4/sources/b40f59c8-01c8-4202-bb0c-8dd0fb3a93f6", "type": "DELETE", "title": "Delete" }, { "rel": "createSchedule", "href": "api/projects/4/sources/b40f59c8-01c8-4202-bb0c-8dd0fb3a93f6/schedules", "type": "POST", "title": "Create Schedule" } ], "acl": { "rel": "acl", "href": "api/projects/4/sources/b40f59c8-01c8-4202-bb0c-8dd0fb3a93f6/acl", "title": "acl" }, "owningProject": { "rel": "owningProject", "href": "api/projects/4", "title": "RT_TestProject1", "id": "4" }, "type": "sources", "lastModifiedDate": "2013-07-30T06:39:49+05:30", "createDate": "2013-07-30T06:39:49+05:30", "createdBy": "Administrator", "predefined": false, "deployable": true, "deployState": "DRAFT", "force": false, "dtError": "There are no schedules attached to this Source", "sourceType": "SqlSource", "sourceTypeDisplayName": "SQL Source", "schedulable": true, "config": { "fetchSize": "10", "sql": "select * from stock where price < 20", "updateSql": null, "bufferResult": "no", "markerId": null, "parameters": null, "propertyMetadataMap": "*", "transactionSize": "0" }, "topics": [ { "href": "api/projects/4/topics/e1accb9c-b1a0-431b-b771-bc7662811e95", "title": "SqlTopic1", "objectType": "topics", "id": "e1accb9c-b1a0-431b-b771-bc7662811e95" } ], "connection": { "rel": "connection", "href": "api/projects/4/connections/1d559d37-2c6e-48c0-8623-c571339c1e99", "title": "SqlConnection1", "id": "1d559d37-2c6e-48c0-8623-c571339c1e99" }, "marshaller": { "marshallerClassname": null, "marshallerProperties": null, "marshallerThreadsafe": false } }
Response Code: 201 Created

POST Request in XML Format

Generate a POST request. For example, the following POST request creates an SQL source in a RulePoint application:
POST http://localhost:8080/rulepoint/api/projects/1/sources Accept: application/xml Content-Type: application/xml Cookie: JSESSIONID=<VALID SESSION ID>

POST Body in XML Format

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <source> <name>sqlsrc1</name> <type>sources</type> <config> <entry> <key>fetchSize</key> <value>10</value> </entry> <entry> <key>sql</key> <value>select * from stock</value> </entry> <entry> <key>updateSql</key> <value/> </entry> <entry> <key>bufferResult</key> <value>no</value> </entry> <entry> <key>markerId</key> <value/> </entry> <entry> <key>parameters</key> </entry> <entry> <key>propertyMetadataMap</key> </entry> <entry> <key>transactionSize</key> <value>0</value> </entry> </config> <connection> <href>api/projects/1/connections/2d5c8d79-b732-4fe8-ad69-3243d102ed49</href> <id>2d5c8d79-b732-4fe8-ad69-3243d102ed49</id> <rel>connection</rel> <title>sqlconnection</title> </connection> <sourceType>SqlSource</sourceType> <topics> <topic> <href>api/projects/1/topics/13dcf0cf-4d29-434a-98ae-99dff34367ab</href> <id>13dcf0cf-4d29-434a-98ae-99dff34367ab</id> <objectType>topics</objectType> <title>sqltopic</title> </topic> </topics> </source>

POST Response in XML Format

Returns the SQL response object and response code. Returns the error object if an error occurs.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <source> <acl> <href>api/projects/1/sources/01eec793-87aa-44fe-a12d-ee3b98e0e71d/acl</href> <rel>acl</rel> <title>acl</title> </acl> <actions> <action> <href>api/projects/1/sources/01eec793-87aa-44fe-a12d-ee3b98e0e71d</href> <rel>update</rel> <title>Edit</title> <type>PUT</type> </action> <action> <href>api/projects/1/sources/01eec793-87aa-44fe-a12d-ee3b98e0e71d</href> <rel>delete</rel> <title>Delete</title> <type>DELETE</type> </action> <action> <href>api/projects/1/sources/01eec793-87aa-44fe-a12d-ee3b98e0e71d/schedules</href> <rel>createSchedule</rel> <title>Create Schedule</title> <type>POST</type> </action> </actions> <id>01eec793-87aa-44fe-a12d-ee3b98e0e71d</id> <links/> <name>sqlsrc1</name> <owningProject> <href>api/projects/1</href> <id>1</id> <rel>owningProject</rel> <title>Default Project</title> </owningProject> <self> <href>api/projects/1/sources/01eec793-87aa-44fe-a12d-ee3b98e0e71d</href> <id>01eec793-87aa-44fe-a12d-ee3b98e0e71d</id> <rel>self</rel> <title>sqlsrc1</title> </self> <valid>false</valid> <createDate/> <createdBy>Administrator</createdBy> <deployState>DRAFT</deployState> <deployable>true</deployable> <dtError>There are no schedules attached to this Source</dtError> <force>false</force> <lastModifiedDate/> <predefined>false</predefined> <type>sources</type> <config> <entry> <key>fetchSize</key> <value>10</value> </entry> <entry> <key>sql</key> <value>select * from stock</value> </entry> <entry> <key>updateSql</key> <value/> </entry> <entry> <key>bufferResult</key> <value>no</value> </entry> <entry> <key>markerId</key> <value/> </entry> <entry> <key>parameters</key> </entry> <entry> <key>propertyMetadataMap</key> </entry> <entry> <key>transactionSize</key> <value>0</value> </entry> </config> <connection> <href>api/projects/1/connections/2d5c8d79-b732-4fe8-ad69-3243d102ed49</href> <id>2d5c8d79-b732-4fe8-ad69-3243d102ed49</id> <rel>connection</rel> <title>sqlconnection</title> </connection> <marshaller> <marshallerProperties/> <marshallerThreadsafe>false</marshallerThreadsafe> </marshaller> <schedulable>true</schedulable> <sourceType>SqlSource</sourceType> <sourceTypeDisplayName>SQL Source</sourceTypeDisplayName> <topics> <topic> <href>api/projects/1/topics/13dcf0cf-4d29-434a-98ae-99dff34367ab</href> <id>13dcf0cf-4d29-434a-98ae-99dff34367ab</id> <objectType>topics</objectType> <title>sqltopic</title> </topic> </topics> </source>
Response Code : 201 Created

0 COMMENTS

We’d like to hear from you!