Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

How to Access File from Appery Database

So with this syntax I was able to get it to work:

code function initialize() {
var race_ID_GPX = localStorage.getItem("raceIDLocalVar");
var db_ID = "5187fbe2e4b0446b3349dkkd&quot
var serverUrl = 'https://api.appery.io/rest/1/db/files/'+race_ID_GPX;
var session_token = localStorage.getItem("_sessionToken");

and

$.ajax({
type: "GET",
headers: {"X-Appery-Database-ID":db_ID,"X-Appery-Session-Token":session_token},
url: serverUrl,
dataType: "xml",
success: function (xml) {
/code

However my file name(100104) pulled from localStorage.getItem("raceIDLocalVar"); doesn't work unless I hardcode the full file name of 952185dd-da7e-4364-9fbe-2d72363b10ac.100104.

Any suggestions of overcoming this? :)

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

How to Access File from Appery Database

Hi Stephen,

In the following line:
codeheaders: {'X-Appery-Database-ID':'db_ID','X-Appery-Session-Token':'session_token'}/codereplace 'db_ID' with the db_ID variable name

You don't have to send session when receiving a file, i.e. must be:
codeheaders: {'X-Appery-Database-ID':db_ID}/code

Check if db_ID is correct.

Also when loading a file to Database - a line is added to the name for uniqueness. Do you have a proper name in localStorage raceIDLocalVar? Please check in Admin tab.

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

How to Access File from Appery Database

Hello Katya! I am getting it to work now. But my new issue is :

However my file name(100104) pulled from localStorage.getItem("raceIDLocalVar"); doesn't work unless I hardcode the full file name of 952185dd-da7e-4364-9fbe-2d72363b10ac.100104.

Any suggestions of overcoming this? :)

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

How to Access File from Appery Database

i.e. I would just like to use 100104

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

How to Access File from Appery Database

I think I have thought of a work around though, I will let you know if it works

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

How to Access File from Appery Database

Let us know, please.

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

How to Access File from Appery Database

Hello! Did it help?

Stephen Goveia
Posts: 0
Joined: Fri May 10, 2013 3:35 pm

How to Access File from Appery Database

Hi Katya! Yes I got it working. You could mark this one as "Solved" Thank you so much for your help!

Return to “Issues”