REST API, code:105,error:Invalid field name

431 views
Skip to first unread message

Hans Palm

unread,
Dec 26, 2016, 7:00:23 AM12/26/16
to back{4}app
I've just started migration of a test application from parse.com to back{4}app.

I've managed to query the class from from an OSX app and it works OK.

Having problems with the rest API and I cannot find much documentation.

The first thing I noticed was that the format was not completely compatible.

Working example using parse.com:

curl -X GET -H "X-Parse-Application-Id: ID" -H "X-Parse-REST-API-Key: Key" --data-urlencode 'where={"Column":{"$regex":"^TITLE$","$options":"i"}}'   --data-urlencode 'limit=999'   https://api.parse.com/1/classes/Class"


apart from changing the server address, I had to remove the /1/


curl -X GET -H "X-Parse-Application-Id: ID" -H "X-Parse-REST-API-Key: Key" --data-urlencode 'where={"Column":{"$regex":"^TITLE$","$options":"i"}}'   --data-urlencode 'limit=999'   https://parseapi.back4app.com/classes/Class"


Now I'm having problem with updating data.


Old code using parse.com:


curl -X PUT -H "X-Parse-Application-Id: ID"   -H "X-Parse-REST-API-Key: Key"  -H "Content-Type: application/json" -d '{"Column":{"__type":"Date","iso":"2016-12-26T11:38:05.000Z"}}' https://api.parse.com/1/classes/Class/object


Tried changing this accordingly


curl -X PUT -H "X-Parse-Application-Id: ID"   -H "X-Parse-REST-API-Key: Key"  -H "Content-Type: application/json" -d '{"Column":{"__type":"Date","iso":"2016-12-26T11:38:05.000Z"}}' https://parseapi.back4app.com/classes/Class/object


But I get the following error message in the result and I haven't find a way to solve the problem.


{"code":105,"error":"Invalid field name: {\"Column\": \"2016-12-26T11:38:05."}


Any Ideas?



Hans Palm

unread,
Dec 26, 2016, 7:39:41 AM12/26/16
to back{4}app
Also tried "Web Host + Live Query"

But wasn't able to do anything, got this message

Subdomain already created

Davi Macêdo

unread,
Dec 26, 2016, 9:54:56 AM12/26/16
to back{4}app
Hi, Hans. About your api problem, could you please send me your app id to ad...@back4app.com? I will take a look on your logs and revert to you.

About the Web Host + Live Query you are probably choosing a subdomain.back4app.io that is already taken by another user. Could you please try another?

Best!

Hans Palm

unread,
Dec 27, 2016, 3:11:45 AM12/27/16
to back{4}app
I did send you the info by mail yesterday. Also enabled Web Host + Live Query, no difference.

Is there something wrong with the format of the REST API call?

I also tried other updates, simple text attribute updates, same response.

Davi Macêdo

unread,
Dec 27, 2016, 11:18:57 AM12/27/16
to back{4}app
Web Host + Live Query are not related to what you are doing. Web Host is a feature to allow you server a web site in your customdomain.back4app.io and Live Query is a feature to allow you to use real time queries.

The format you are using seems to be right but I took a look in your app and there is no class called Class (I don't know if you are really using it or just specified "Class" as an example). Anyway, because of the message you are receiving, it seems you have something wrong with your escape chars and the api is not recognize the correct name of your field. Could you please send me by e-mail the exact command you are using?

The right command should be something like this one below (this is a command to one of my test apps - I've just tested and it run perfectly - try to run it and see if it works for you):

curl -X PUT -H "X-Parse-Application-Id: xngyuuHe5BQcVricqkDs71ZLWckutgvjM14V69Xu" -H "X-Parse-REST-API-Key: gnNWEr3fM7FdlE09xB6BiO8XE7XqQH3QzooKbTj5" -H "Content-Type: application/json" -d '{"myColumn":"myValueA"}' https://parseapi.back4app.com/classes/MyClass/1FGao6eG2w


best!
Message has been deleted

Hans Palm

unread,
Dec 27, 2016, 12:53:56 PM12/27/16
to back{4}app
I was using placeholders, not the exact data. Will try again and send you the exact command if it fails again.

Davi Macêdo

unread,
Dec 27, 2016, 1:09:50 PM12/27/16
to back{4}app
Sure. Keep me updated. Best!

Hans Palm

unread,
Dec 27, 2016, 1:13:03 PM12/27/16
to back{4}app
Sent you a mail...

Davi Macêdo

unread,
Dec 27, 2016, 1:36:26 PM12/27/16
to back{4}app
Just sent to you the correct command by e-mail.

Hans Palm

unread,
Dec 28, 2016, 6:34:47 AM12/28/16
to back{4}app
Migration was cancelled according to parse.com, probably due to some timeout. I guess this doesn't matter if the migrated database is up and running att back4app and only this server address is used?

Davi Macêdo

unread,
Dec 28, 2016, 7:03:31 AM12/28/16
to back{4}app
You need to migrate again. Delete your app in back4app and start the migration process again. Otherwise parse.com will not be synced with back4app.com

Best!

Hans Palm

unread,
Dec 28, 2016, 11:33:59 AM12/28/16
to back{4}app
Yes but the synchronisation is not needed when migration has been completed. If the app is working at back4app.com and parse.com is no longer used, I don't need to start the migration again unless back4app rolls back the migration or similar. 

I may misunderstand this but if it's working at back4app i can delete the app att parse.com or just ignore it, it won't work anyway when parse discontinues its service. 

Davi Macêdo

unread,
Dec 28, 2016, 11:42:12 AM12/28/16
to back{4}app
You are right, but your customers will keep connecting to your database through parse.com api till the day you will launch the new version of your app connecting to back4app.com api and they update their apps.

So, if your app is still under development, no worries, you don't need to migrate again.

But, if your app is already in the store, it is important you migrate again and make parse.com api and back4app.com to work synced.

mcven...@gmail.com

unread,
Apr 4, 2017, 7:33:51 AM4/4/17
to back{4}app
For future references, on Windows systems, the exact format must be escaped for values and only with double quotes for the -d container (after 30 mins of testing):
Reply all
Reply to author
Forward
0 new messages