Page 1 of 3
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 5:59 pm
by Agon Bina
Hi,
I am trying to test a rest call on the browser using the following url:
https://api.tiggzi.com/rest/1/db/coll...
And I keep getting this json response:
{"code":"request","description":"database id not specified"}
How do I specify the ID correctly in an https call to your database?
Thanks!
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 6:08 pm
by maxkatz
Are you testing directly from the browser?
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 6:12 pm
by Agon Bina
Yes! I also tried the following javascript function and I got the same thing:
function testRest()
{
$.getJSON("https://api.tiggzi.com/rest/1/db/coll...",
{
'X-Tiggzi-Database-Id': 'xxxxxxxxxxxxxxxxx', // actual database id instead of x's
'type': 'get',
'dataType': 'json',
'contentType': 'application/json',
},
function(data) {
alert(data);
});
}
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 6:17 pm
by maxkatz
I don't know why your request doesn't work, but if you do a curl command it works:
curl -X GET -H "X-Tiggzi-Database-Id: xxxxxxxxxxxxxxxxxxxxxx" https://api.tiggzi.com/rest/1/db/coll...
X-Tiggzi-Database-Id -- is a header parameter.
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 6:20 pm
by Agon Bina
Hmmm I don't know why either, I am thinking the proper tag for the database ID is not X-Tiggzi-Database-Id when using .getJSON
Is there any way to make a curl call using javascript or jquery and then play around with the returned data?
Thanks!
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 6:28 pm
by maxkatz
It will be the same parameter name: X-Tiggzi-Database-Id
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 6:32 pm
by Agon Bina
No, I am saying how do I make a curl call in javascript? Or how am i supposed to execute the curl call so that I can receive the data back ?
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 6:33 pm
by maxkatz
Make a jQuery Ajax call...
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 7:37 pm
by Agon Bina
function testRest()
{
$.ajax({
url: "https://api.tiggzi.com/rest/1/db/coll...",
'X-Tiggzi-Database-Id': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
type: 'POST',
dataType: 'jsonp',
contentType: 'application/json',
"message": 'testing', // this is a data field in the database
},
function(data) {
alert('success');
console.log(data);
});
}
I am trying this but it won't work create a new entry in the database, any idea what am I doing wrong? All the information I've entered is correct ...
how to perform HTTPS calls to Tiggzi database rest service?
Posted: Fri Dec 07, 2012 8:40 pm
by maxkatz
X-Tiggzi-Database-Id needs to be a header...