Jesper Simonsen
Posts: 0
Joined: Sat Sep 28, 2013 8:37 am

"message":"Collection id must be defined."

I have attached some images of a servercode that worked for a couple of weeks ago, but now it gives this response message: "message":"Collection id must be defined."

It used to be enough to give collectionName and ColumnName on number column and it world calculate the total sum for that column.When testing under "Server Code" everything works without any errors.

What am I missing? Image Image Image Image

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

"message":"Collection id must be defined."

Hello,

When you test your service please check browser console network tab - Is there DB ID in your request?
http://docs.appery.io/documentation/d...

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

"message":"Collection id must be defined."

Hi Jesper.

Please try the next:

1 Verify whether In server script "collectionName" and "columnName" variables exist and have correct values. You can do it with temporary code:
pre

response.success({collectionName: collectionName, columnName: columnName}, "application/json");/pre

2 Please look at browser console network tab. And get request (not only response).

Jesper Simonsen
Posts: 0
Joined: Sat Sep 28, 2013 8:37 am

"message":"Collection id must be defined."

I get this under exec (have removed servercode below for security reasons):
Request URL:https://api.appery.io/rest/1/code/"se...&
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/plain, /; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:da-DK,da;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Host:api.appery.io
Origin:https://appery.io
Referer:https://appery.io/servercode/"serverC...
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
Query String Parametersview sourceview URL encoded
ColumnName:ListPrise
collectionName:Product
:
Response Headersview source
Access-Control-Allow-Origin:https://appery.io
Connection:keep-alive
Content-Type:application/json
Date:Thu, 20 Feb 2014 11:47:48 GMT
Server:nginx
Transfer-Encoding:chunked

Jesper Simonsen
Posts: 0
Joined: Sat Sep 28, 2013 8:37 am

"message":"Collection id must be defined."

And in RestService i get this test response:
{
"code":"DBSQ253",
"columnName":null,
"collectionName":null,
"message":"Collection id must be defined."
}

Jesper Simonsen
Posts: 0
Joined: Sat Sep 28, 2013 8:37 am

"message":"Collection id must be defined."

I now got it to work again. I did a couple of changes and it is working again (see changed serverscript below). I changed "collectionName" to "collName" and substituted the second "semicolon" with a "comma".

Code: Select all

  var DB_id='hidden for security reasons', 

 collectionName= request.get("collName"), 
 columnName = request.get("ColumnName"); 

try {
query = Collection.query(DB_id, collectionName);
var i, len, value, sum = 0;
for(i = 0, len = query.length; i < len; i++) {
value = parseFloat(query[columnName]);
if (value) {
sum += value;
}
}
response.success({totalSum: numeral(sum).format('0,0.00')}, "application/json");
} catch (e) {
response.success({collectionName: e.collectionName, columnName: e.columnName,message: e.message, code: e.code}, "application/json");
}

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

"message":"Collection id must be defined."

Hi Jesper,

Glad it works. Let us know if you need any help.

Jesper Simonsen
Posts: 0
Joined: Sat Sep 28, 2013 8:37 am

"message":"Collection id must be defined."

000.00\""}""

Return to “Issues”