Page 2 of 3

Updating Rest Service

Posted: Wed Jan 02, 2013 5:34 pm
by maxkatz

Updating Rest Service

Posted: Thu Jan 03, 2013 10:59 am
by Joe Bohen

Hi,
Now I have changed the ‘service’ to a ‘database service’ I have mapped the status field with custom javascript to return the object id and the request parameters. I get a 200 OK followed by a 500 error when testing. I have made screen shots of the settings would you please advise me on how to proceed.
The code in the status mapping is:
var objectid = localStorage.getItem('jobid');
var newstatus = "Test";
return objectid + "/" + '{"status":"'+newstatus+'"}';
The requests viewed in chrome are:
Request URL:https://api.tiggzi.com/rest/1/db/coll...
Request Method:OPTIONS
Status Code:200 OK
Request Headersview source
Accept:/
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:origin, content-type, accept, x-tiggzi-database-id
Access-Control-Request-Method:PUT
Connection:keep-alive
DNT:1
Host:api.tiggzi.com
Origin:http://project.tiggzi.com
Referer:http://project.tiggzi.com/view/7cf542...
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
Response Headersview source
Access-Control-Allow-Headers:origin, content-type, accept, x-tiggzi-database-id
Access-Control-Allow-Methods:PUT
Access-Control-Allow-Origin:http://project.tiggzi.com
Connection:keep-alive
Content-Length:0
Date:Thu, 03 Jan 2013 09:56:00 GMT
Server:nginx
Set-Cookie:JSESSIONID=ktJQLMut5ZyHQKthmZieJ-K8.undefined; Path=/; Secure

500 Error:
Request URL:https://api.tiggzi.com/rest/1/db/coll...
Request Method:PUT
Status Code:500 Internal Server Error
Request Headersview source
Accept:application/json, text/javascript, /; q=0.01
Accept-Charset:ISO-8859-1,utf-8;q=0.7,;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:2
Content-Type:application/json
DNT:1
Host:api.tiggzi.com
Origin:http://project.tiggzi.com
Referer:http://project.tiggzi.com/view/7cf542...
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
X-Tiggzi-Database-Id:50b3a600e4b0747d4efdf493
Request Payload
{}
Response Headersview source
Access-Control-Allow-Origin:
Connection:keep-alive
Content-Type:application/json
Date:Thu, 03 Jan 2013 10:18:15 GMT
Server:nginx
Transfer-Encoding:chunked

Image


Updating Rest Service

Posted: Thu Jan 03, 2013 11:14 am
by Maryna Brodina

Hello! Could you please send us your app link (make it public)? You can post it here or email to support@tiggzi.com


Updating Rest Service

Posted: Thu Jan 03, 2013 11:22 am
by Joe Bohen

Hi, shared with support@tiggzi.com


Updating Rest Service

Posted: Thu Jan 03, 2013 11:27 am
by Maryna Brodina

Thank you. App name is Trans_App correct?


Updating Rest Service

Posted: Thu Jan 03, 2013 11:33 am
by Joe Bohen

Hi, yes that is correct thanks.


Updating Rest Service

Posted: Thu Jan 03, 2013 11:41 am
by Joe Bohen

Hi Marina, should have said the service is invoked from the settings button on the jobs list page.


Updating Rest Service

Posted: Thu Jan 03, 2013 11:42 am
by Maryna Brodina

Thank you. We'll test


Updating Rest Service

Posted: Thu Jan 03, 2013 1:52 pm
by Maryna Brodina

1) You have to send X-Tiggzi-Session-Token value when you work with DB (try to save Session-Token in local storage, use mapping to send Session-Token while request to DB);
2) delete your JS (just map your object_id parameter to objectid local storage to get that value - take a look at the screenshot);
3) also please delete request parameters which you are not going to update (not sure it's ok to send them empty);

Image


Updating Rest Service

Posted: Thu Jan 03, 2013 3:32 pm
by Joe Bohen

Hi Marina,

Thank you for the time you have spent on this issue, but unfortunately I am still experiencing problems.

I have save the session token to local storage and mapped the service to this.

I have deleted the JS and mapped the object_id to the local storage variable.

I have removed the fields that are not required.

Examining the request in chrome it would appear that the object_id is not appended to the url.

Request URL:https://api.tiggzi.com/rest/1/db/coll...
Request Method:PUT
Status Code:500 Internal Server Error
Request Headersview source
Accept:application/json, text/javascript, /; q=0.01
Accept-Charset:ISO-8859-1,utf-8;q=0.7,;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:17
Content-Type:application/json
DNT:1
Host:api.tiggzi.com
Origin:http://project.tiggzi.com
Referer:http://project.tiggzi.com/view/7cf542...
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
X-Tiggzi-Database-Id:50b3a600e4b0747d4efdf493
X-Tiggzi-Session-Token:05067779-eb21-4e0c-b847-cb4547d9a22c
Request Payload
{"status":"Test"}
Response Headersview source
Access-Control-Allow-Origin:
Connection:keep-alive
Content-Type:application/json
Date:Thu, 03 Jan 2013 15:24:30 GMT
Server:nginx
Transfer-Encoding:chunked

Image