Skip to content

Commit e287bad

Browse files
author
Ram Kumar
committed
feat(api): Endpoint URL supported now users can change zc endpoint using app.form.changeEndPointURL(
1 parent 110a1dd commit e287bad

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/form.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ class Form{
66
constructor(appconf,formconf){
77
this.appconf = appconf
88
this.formName = formconf.formName
9+
this.endpointURL = 'https://creator.zoho.com/api/';
910
}
1011

1112
add(formdata)
1213
{
1314
return this.post(formdata)
1415
}
16+
changeEndPointURL(url)
17+
{
18+
this.endpointURL = url;
19+
}
1520
update(formdata,criteria)
1621
{
17-
this.endpoint = 'https://creator.zoho.com/api/'+this.appconf.ownername+'/json/'
22+
this.endpoint = this.endpointURL+this.appconf.ownername+'/json/'
1823
+this.appconf.appName+'/form/'+this.formName+'/record/update'
1924

2025
formdata['authtoken'] = this.appconf.authtoken
@@ -73,7 +78,7 @@ class Form{
7378
}
7479
post(formdata)
7580
{
76-
this.endpoint = 'https://creator.zoho.com/api/'+this.appconf.ownername+'/json/'
81+
this.endpoint = this.endpointURL+this.appconf.ownername+'/json/'
7782
+this.appconf.appName+'/form/'+this.formName+'/record/add'
7883
formdata['authtoken'] = this.appconf.authtoken
7984
formdata['scope'] = 'creatorapi'
@@ -126,7 +131,7 @@ class Form{
126131
}
127132
delete(criteria)
128133
{
129-
this.endpoint = 'https://creator.zoho.com/api/'+this.appconf.ownername+'/json/'
134+
this.endpoint = this.endpointURL+this.appconf.ownername+'/json/'
130135
+this.appconf.appName+'/form/'+this.formName+'/record/delete'
131136
var formdata = {}
132137
formdata['authtoken'] = this.appconf.authtoken

src/view.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ class View{
99
{
1010
this.appconf = appconf;
1111
this.viewName = viewconf.viewName;
12-
this.formName = viewconf.formName
12+
this.formName = viewconf.formName;
13+
this.endpointURL = 'https://creator.zoho.com/api/';
14+
}
15+
changeEndPointURL(url)
16+
{
17+
this.endpointURL = url;
1318
}
1419
find(criteria,startingIndex,limit){
1520
return this.get(criteria,startingIndex,limit)
@@ -19,8 +24,7 @@ class View{
1924
}
2025
get(criteria,startingIndex,limit)
2126
{
22-
this.endpoint = 'https://creator.zoho.com/api/json/'
23-
+this.appconf.appName+'/view/'+this.viewName
27+
this.endpoint = this.endpointURL+this.appconf.appName+'/view/'+this.viewName
2428
var query = {}
2529

2630
query['authtoken'] = this.appconf.authtoken

0 commit comments

Comments
 (0)