<turbo-stream action="update" target="wiki_3611_3715_subpage_3720_info"><template>
<p>Below you see an example of how to create a connection. Examples both in JSON and JSONAPI are provided.

</p><p>NOTE: Remember to substitute the token (after Bearer) and the service id (the "[SERVICE ID]" below) to your own token and service id.</p>
<p></p><h2>JSON:</h2><p></p>
<p>In this example, we are creating a NAV SQL connection with RapidiConnector.</p>
<pre class="card">curl 
  -H "Authorization: Bearer [API SECURITY TOKEN]"
  -H "Content-Type: application/json" 
  -H "Accept: application/json"
  -X POST
  data = "{\"code\":\"CONN_NAVSQL\",\"description\":\"my new navsql connection with RapidiConnector\",\"connection_type\":\"ms_dynamics_nav_sql\",
           \"server_connect\":\"WIN-XXX\NAVDEMO\",\"database\":\"Demo Database NAV (X-0-X)\",\"account\":\"Cronus\",
           \"use_windows_authentication\": true, \"rapidiconnector\":{\"password\":\"\"}}"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/connections
</pre>
<p>The out-put for this example would be:</p>
<pre class="card">{
  "id": "5",
  "code": "CONN_NAVSQL",
  "description": "my new navsql connection with RapidiConnector",
  "connection_type": "ms_dynamics_nav_sql",
  "server_connect": "WIN-XXXNAVDEMO"'
  "database": "Demo Database NAV (X-0-X)",
  "account": "Cronus",
  "use_windows_authentication": true,
  "user_id": null,
  "rapidiconnector": {
    "user_id": "CONN_NAVSQL_R",
    "password": "ECz2xxxxx"
  },
  "comments": []
}

</pre>
<p>The user_id for the RapidiConnector will automatically be generated and if you leave the password blank it will also be generated automatically else it will set the password you specify.</p>
<p></p><h2>JSONAPI:</h2><p></p>
<p>In this example, we are creating a salesforce.com connection.</p>
<pre class="card">curl 
  -H "Authorization: Bearer [API SECURITY TOKEN]"
  -H "Content-Type: application/vnd.api+json" 
  -H "Accept: application/vnd.api+json"
  -X POST
  data = "{\"data\":{\"type\":\"connections\",\"attributes\":{\"code\":\"CONN_SFDC\",\"description\":\"SFDC connection\", 
           \"connection_type\":\"salesforce_com\", \"user_id\":\"admin@demo.com\",\"password\":\"xxx\",
           \"use_ssl\":true,\"sandbox\":true }} }"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/connections
</pre>
<p>The out-put for this example would be:</p>
<pre class="card">{
  "data":{
    "id": "2",
    "type": "connections",
    "attributes": {
      "code": "CONN_SFDC",
      "description": "SFDC connection",
      "connection_type": "salesforce_com",
      "user_id": "admin@demo.org",
      "use_ssl": true,
      "sandbox": true
    },
    "relationships": {
      "comments": {
        "data": []
      }
    }
  }
}
</pre>
</template></turbo-stream>
<turbo-stream action="prepend" target="flash"><template></template></turbo-stream>
