2022

Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Rest API Documentation for Partner APIs

Base Path : http://staging.mydbsync.com/appcenter-2-2/appcode/v1/partner

Methods


  1. registerUser: This api can be used for creation of new users.

It returns json for newly registered unique user.
POST <span style="color: #1155cc"><span style="text-decoration: underline; ">/registerUser</span></span>
Consumes : This api consumes application/json media type.
Returns : Json object
Produces : This api produces application/json media type.
To create user we can use HTTP POST method :
Headers : Content-Type: application/json
Accept: application/json
Body :
{
"partnerAppKey":"ApplicationKey",
"partnerAppToken":"ApplicationToken",
"endUserCompany":"CompanyName",
"endUserName":"UserName"
}
**All parameters are required
partnerAppKey (Required): API appkey provided by DBSync must be present in body of request. This will help to uniquely Identify application.
partnerAppToken (Required): API token provided by DBSync must be present in body of request. This will help to uniquely Identify application.
endUserCompany (Required): User's Company Name
endUserName (Required): uniquely identifiable username.
Response : This will be json form.
Response will always be 200 HTTP OK
ex:
{ "value": [ { "companyId": <span style="color: #880000">"9877"</span>, "userId": <span style="color: #880000">"5773"</span>, "userName": <span style="color: #880000">"TestComp001_User008"</span>, "errorMessage": [] } ]}
If there are no error while creation of user then error message will be empty.
CURL :
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"partnerAppKey":"appkey","partnerAppToken":"apptoken","endUserCompany":"companyName","endUserName":"userName"}' 'http://staging.mydbsync.com:80/appcenter-2-2/appcode/v1/partner/registerUser'

  1. unregisterUser: This api is used for unregister an existing user for a partner.

It returns json result for the unregistered user request.
POST <span style="color: #1155cc"><span style="text-decoration: underline; ">/unregisterUser</span></span>
Consumes : This api consumes application/json media type.
Returns : Json object
Produces : This api produces application/json media type.
To create user we can use HTTP POST method :
Headers : Content-Type: application/json
Accept: application/json
Body :
{
"partnerAppKey":"ApplicationKey",
"partnerAppToken":"ApplicationToken",
"endUserCompany":"CompanyName",
"endUserName":"UserName"
}
**All parameters are required
partnerAppKey (Required): API appkey provided by DBSync must be present in body of request. This will help to uniquely Identify application to unregister for.
partnerAppToken (Required): API token provided by DBSync must be present in body of request. This will help to uniquely Identify application to unregister for.
endUserCompany (Required): User's Company Name
endUserName (Required): uniquely identifiable username.
Response : This will be json form.
Response will always be 200 HTTP OK
ex:
{ "value": [ { "success": <span style="color: #008800">true</span>,
"companyId": <span style="color: #880000">"9877"</span>,"userId": <span style="color: #880000">"5773"</span>,"userName": <span style="color: #880000">"TestComp001_User008"</span>,"errorMessage": []}]
}
If there are no error while unregistering user then error message will be empty.
If user is unregistered then success will be true.
CURL :
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"partnerAppKey":"appkey","partnerAppToken":"apptoken","endUserCompany":"companyName","endUserName":"username"}' 'http://staging.mydbsync.com/appcenter-2-2/appcode/v1/partner/unregisterUser'

  1. authenticateUser: Authenticates an existing user (for a partnered application) to check if they have valid license to run the integration.


It returns json for newly registered unique user.
POST <span style="color: #1155cc"><span style="text-decoration: underline; ">/authenticateUser</span></span>
Consumes : This api consumes application/json media type.
Returns : Json object
Produces : This api produces application/json media type.
To create user we can use HTTP POST method :
Headers : Content-Type: application/json
Accept: application/json
Body :
{
"partnerAppKey":"ApplicationKey",
"partnerAppToken":"ApplicationToken",
"endUserCompany":"CompanyName",
"endUserName":"UserName"
}
**All parameters are required
partnerAppKey (Required): API appkey provided by DBSync must be present in body of request. This will help to uniquely Identify application to authenticate for.
partnerAppToken (Required): API token provided by DBSync must be present in body of request. This will help to uniquely Identify application to authenticate for.
endUserCompany (Required): User's Company Name
endUserName (Required): uniquely identifiable username.
Response : This will be json form.
Response will always be 200 HTTP OK
ex:
{ "value": [ { "companyId": <span style="color: #880000">"9877"</span>, "userId": <span style="color: #880000">"5773"</span>, "userName": <span style="color: #880000">"TestComp001_User008"</span>, "errorMessage": [] } ]}
If there are no error while authenticating user then error message will be empty.
CURL :
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"partnerAppKey":"appkey","partnerAppToken":"apptoken","endUserCompany":"companyName","endUserName":"userName"}' 'http://staging.mydbsync.com/appcenter-2-2/appcode/v1/partner/authenticateUser'

  1. licenseDetails: Fetches license details of all (or single, using filter) users registered for the partner.


POST <span style="color: #1155cc"><span style="text-decoration: underline; ">/licenseDetails</span></span>
Consumes : This api consumes application/json media type.
Returns : Json object
Produces : This api produces application/json media type.
To create user we can use HTTP POST method :
Headers : Content-Type: application/json
Accept: application/json
Body :
{
"partnerAppKey":"ApplicationKey",
"partnerAppToken":"ApplicationToken",
"endUserCompany":"CompanyName",
"endUserName":"UserName"
}
partnerAppKey (Required): API appkey provided by DBSync must be present in body of request. This will help to uniquely Identify application to authenticate for.
partnerAppToken (Required): API token provided by DBSync must be present in body of request. This will help to uniquely Identify application to authenticate for.
endUserCompany (Optional): User's Company Name, If companyName in provided then all active user for that company will be retrieved.
endUserName (Optional): uniquely identifiable username, If username id provided then all available user with that company will be retrieved.
Response : This will be json form.
Response will always be 200 HTTP OK
ex:
{ "value": [ { "createDate": <span style="color: #880000">"2016-10-27 02:55:57.0"</span>, "expiryDate": <span style="color: #880000">"2036-10-27"</span>, "companyId": <span style="color: #880000">"9877"</span>, "userId": <span style="color: #880000">"5764"</span>, "userName": <span style="color: #880000">"TestComp001_User001"</span>, "errorMessage": [] }, { "createDate": <span style="color: #880000">"2016-10-27 02:57:07.0"</span>, "expiryDate": <span style="color: #880000">"2036-10-27"</span>, "companyId": <span style="color: #880000">"9877"</span>, "userId": <span style="color: #880000">"5765"</span>, "userName": <span style="color: #880000">"TestComp001_User002"</span>, "errorMessage": [] },---
]}
If there are no error while licensing user then error message will be empty.
<span style="color: #444444"><strong>CURL :</strong></span>
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"partnerAppKey":"appkey","partnerAppToken":"apptoken","endUserCompany":"companyName","endUserName":"userName"}' 'http://staging.mydbsync.com/appcenter-2-2/appcode/v1/partner/licenseDetails'

DBSync Widget

Repository: https://<username>/dbsync/dbsync-widget-js.git
1. Initialize the plugin by referencing the necessary files:
<link rel="stylesheet" type="text/css" href="dbsyncwidget.min.css">
<script src="${pageContext.request.contextPath}/scripts/bootstrap.min.js"></script>
<script src="dbsyncwidget.min.js"></script>
2. Add div on the page:
<div id="dbsyncwidget"></div>
3. Add javascript initialization in the script tag:
Here are the keys that you can use:
appName - name of application to connect with
validationUrl - API Url to check if application is connected
connectUrl - API Url to connector page
<script>
var dbsyncwidget = null;
var dbsyncButton;
var options = {
appName: 'Application Name',
validationUrl: 'Validation API Url',
connectUrl: 'Connection API Url'
};
$(document).ready(function () {
dbsyncButton = $('#dbsyncwidget');
dbsyncwidget = dbsyncButton.dbsyncwidget(options);
});
4. (Optional: Customizing DBSync widget look&feel).
To change dbsyncwidget button we can override the next css classes:
dbsync-widget-logo - css class which describes styles of the button in case of validation is not successfull
dbsync-widget-logo-connected - css class which describes styles of the button in case of validation is successfull
To change the size of modal window we can override:
modal-large - css class which describes dimension styles of modal window
Example of using dbsyncwidget in c2c:

  1. Add necessary files:

<link href="${pageContext.request.contextPath}/css/dbsyncwidget.min.css" rel="stylesheet" />
<script src="${pageContext.request.contextPath}/scripts/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/scripts/dbsyncwidget.min.js"></script>

  1. Add div:

<div id="dbsyncwidget"></div>

  1. Add script tag:

<script>
var dbsyncwidget = null;
var dbsyncButton;
var params = {
partner_key: '<%=System.getProperty("partnerKey")%>',
partner_token: '<%=System.getProperty("partnerToken")%>',
app_target: 'qbonline',
username: 'TestComp001_User001',
company: 'TestComp001',
appId: 'qbonline',
appName: 'QuickBooks Online',
context: '${pageContext.request.contextPath}',
validationUrl: 'verifyProfile'
};
var options = {
appName: 'QuickBooks Desktop',
validationUrl: 'http://localhost:8080/c2c/verifyProfile/TestComp001_User001',
connectUrl: 'http://localhost:8080/c2c/qbdesktop/qbdesktop/TestComp001_User001/TestComp001'
};
$(document).ready(function () {
dbsyncButton = $('#dbsyncwidget');
dbsyncwidget = dbsyncButton.dbsyncwidget(options);
});
</script>

  1. Add custom css styles:

<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" />
Content of styles.css:
.modal-large {
width: 60%;
}
.dbsync-widget-logo {
outline: none;
text-decoration: none;
border: none;
background: url(../images/logo.png) no-repeat 0 0;
width: 100px;
height: 30px;
display: inline-block;
margin: 5px;
}
.dbsync-widget-logo:hover {
filter: brightness(105%);
}
.dbsync-widget-logo-connected {
outline: none;
text-decoration: none;
border: 2px;
background: url(../images/logo-connected.png) no-repeat 0 0;
width: 100px;
height: 38px;
display: inline-block;
margin: 5px;
}
.dbsync-widget-logo-connected:hover {
filter: brightness(105%);
}
If validation API method responses with json {status: success}
We will see the next button on the page:

Clicking on the button we will see

Otherwise if validation API method responds with status other than success we will see

Clicking on the button we will see

Application Setup

<docker and partner props>
Changes to be done in 2 following files

  1. partner.properties (inside "www/WEB-INF/conf/" folder)
  2. partner_profile.xml (inside "www/WEB-INF/conf/" folder)



  1. partner.properties (inside "www/WEB-INF/conf/" folder)

This file contains the below properties

  1. partnerAppKey(Required)
  2. partnerAppToken(Required)
  3. partner.app.qbdesktop.pdl(Required, if you are using QuickBooks Desktop)
  4. partner.database.driverClassName(Required)
  5. partner.database.url(Required)
  6. partner.database.username(Required)
  7. partner.database.password(Required)
  8. partner.profile.template(Required)
  9. dbsync.logger(Optional)
  10. log.database.driverClassName(Optional)
  11. log.database.url(Optional)
  12. log.database.username(Optional)
  13. log.database.password(Optional)



a) partnerAppKey :
Will be provided by the DBSync
b) partnerAppToken :
Will be provided by the DBSync
c) partner.app.qbdesktop.pdl :
This is for QuickBooks desktop. Provide the process xml absolute path, which you want to run. Process xml will be inside the pdl (project).
Ex : If your pdl name is QuickBooksPdl, and process xml name is processdefinition_CustomerToAccount.xml, then the path will be
<Path to the Directory>/QuickBooksPdl/processdefinition_CustomerToAccount.xml
d) partner.database.driverClassName :
Profile Details and Logs are stored in Database, for this property, provide the Database driver class name. For example : for mysql database, this property will be com.mysql.jdbc.Driver
e) partner.database.url :
Profile Details and Logs are stored in Database, for this property, provide the Database Url along with Database name. For example : for mysql database, this property will look like jdbc:mysql://<ServerName>:<Port>/<Database Name>.
f) partner.database.username :
Profile Details and Logs are stored in Database, for this property, provide the Database Username.
g) partner.database.password :
Profile Details and Logs are stored in Database, for this property, provide the Database Password.
h) partner.profile.template :
profile.xml is the file, where all connector properties are stored. If you have profile.xml and want to use it as template, then provide the absolute path of profile.xml
Ex: <Your path>/profile.xml
i) dbsync.logger :
If you don't want to store the logs in the default database and want to store the logs in other database, then enable this property. Property value will be constant : com.mydbsync.cw.embedded.EmbeddedLogger
If you want to store the logs in the default database itself, then remove or comment this property.
If you enable dbsync.logger, below 4 properties will be used for storing the logs in the different database.
j) log.database.driverClassName :
Provide the Driver class name.
Ex: If mysql, then com.mysql.jdbc.Driver
k) log.database.url :
Provide the Database Url along with Database Name.
Ex: If my sql, then jdbc:mysql://<ServerName>:<Port>/<Database Name>.
l) log.database.username :
Provide the Database Username.
m) log.database.password :
Provide the Database Password.

2) partner_profile.xml (inside "www/WEB-INF/conf/" folder)
This file contains all connector properties. Connector properties are the application properties, from where and to where, you sync the data. All connector properties are closed within <adapters> root tag. Each specific connector will be enclosed within <adapter> tag. Please fill in the details in this xml even before you start using the application.

  • No labels