Skip to main content
14-Alexandrite
March 12, 2021
Question

"Unable to parse json request" error in validation service

  • March 12, 2021
  • 1 reply
  • 1193 views

hello,

getting an error "Unable To Parse JSON Request" while adding membership plan through mashup.

i have one code which gives me existing existing plan name in database and i my another code is validation service created for the mashup where i wanted to compare plan name present in database with the validation service input plan name.

Now when i click on add button it gives me an error "Unable To Parse JSON Request" i dont know why i am getting this error. below is my validation service code:-

// result: INFOTABLE dataShape: ""
let resultName = Things["PostgreSQL_DB"].getPlanName({
plan_name: plan_name /* STRING */
});
// result: BOOLEAN
let Priceresult = me.validateInteger({
number: Price /* STRING */
});

if(plan_name == "" || plan_name == null){
result = 'Please enter Plan Name';
}
else if(resultName.plan_name == plan_name){
result = 'Plan is already exist';
}
//else if(resultName.count > 0)
//{
// result = 'membership plan name is already exist';
//}
else if(Price == "" || Price == null){
result = 'Please enter Price';
}
else if(Priceresult == false){
result = 'Please enter price in number';
}

else if(plan_type_id == "" || plan_type_id == null){
result = 'Please select plan type';
}
else if(plan_type_id == 1){
result= '';
}
else if(plan_type_id == 2){
if(MembershipLength == "" || MembershipLength == null){
result = 'Please enter number of days';
}
else if(frequency_unit == "" || frequency_unit == null){
result = 'Please select membership length';
}
else{
result= '';
}
}


else if(plan_type_id == 3){

if(FromDate == "" || FromDate == null){
result = 'Please select From date';
}
else if(ToDate == "" || ToDate == null){
result = 'Please select To date';
}
else{
result= '';
}
}

1 reply

Community Manager
March 19, 2021

Hi @Ru_01.

 

Is it happening all the time?  Have you checked the logs located in ThingworxStorage\logs for any clues? You may also want to enable stacktrace.  To do so, browse to the LoggingSubsystem and go to the Configuration tab.

 

Regards.

 

--Sharon

Community Manager
March 29, 2021

Hi @Ru_01.

 

If the previous response helped you to find the cause of the issue, please mark it as the Accepted Solution for the benefit of others with the same issue.

 

Regards.

 

--Sharon