Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Need Help! REST APIs Using API Express

I've spent the entire day reading and trying to figure this out. I've solved a lot of my issues - mostly thank to this video (https://blog.appery.io/2015/06/video-...)

But I'm desperately stuck and need help please!

Using the API Express features, I've setup a connection to my MySQL DB. No Problem. I have the API working, no problem.

But for the life of me, cannot get the where query to work! Nothing I've read and tried has worked.

How can I pass the 'where' variable back in the request as is shown in the documentation??

https://appery.io/apiexpress-api/rest...

Tried this too - just throws an error:

You can also test the service; open the service and switch to the Test tab. Paste the following for the where parameter:

{"States":{"$regex":"C", "$options":"i"}}
Click “Test.”

The above will return all states that start with letter C or c. “$options”:”i” is what specifies the query to ignore the case.

Please help :)

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Need Help! REST APIs Using API Express

So what I need to be able to do, is choose which data entries to display based on a criteria.

For example, show all entries that contain 'Beef' in a table column. I've been following the examples, but I cannot seem to get regex to work - eeeeek

Seems so simple, but I'm not getting it :(

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Need Help! REST APIs Using API Express

uggghhhh, after 10 hours of reading and effort, FINALLY found the answers here!!

https://www.youtube.com/watch?v=KeDz6...

sigh....

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Need Help! REST APIs Using API Express

my god, this is enough to drive you insane... still doesn't work!

Test custom service

URL
https://appery.io/apiexpress-api/rest..........

SELECT * FROM Business_Info WHERE contact_name = :name

Name: Business_Info/{name}

Image

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Need Help! REST APIs Using API Express

This SQL works in my MySQL DB:

SELECT * FROM 'Business_Info' WHERE 'contact_name'= "Blair"

How do I translate this to work with Appery?

This is the example from the video - what am I doing wrong?????

Image

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Need Help! REST APIs Using API Express

Trying these SQL statements results in the same error:

// add sql
//SELECT * FROM Business_Info WHERE contact_name = :name
//SELECT * FROM 'Business_Info' WHERE 'contact_name'= ":name"
//SELECT * FROM 'Business_Info' WHERE 'contact_name'= "name"
SELECT * FROM 'Business_Info' WHERE 'contact_name'= :name

{
"code": "MS009",
"message": "Incorrect server configuration",
"status": "INTERNAL_SERVER_ERROR"
}

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

Need Help! REST APIs Using API Express

Hello Blair,

Try this syntax:

preSELECT * FROM Business_Info WHERE contact_name = :?name /pre

Note, should be like precontact_name = :?name /pre

Andrew Main
Posts: 0
Joined: Tue Jun 16, 2015 12:19 pm

Need Help! REST APIs Using API Express

I'm having the exact same issue. the automatically generated ones work just fine. However in my custom service named, "blocks/{id}"

SQL:
select * from blocks where id = :id

returns:
{
"code": "AE009",
"message": "Incorrect server configuration",
"status": "INTERNAL_SERVER_ERROR"
}

and SQL:
select * from blocks where id = :?id

during testing returns:
{
"code": "AE000",
"message": "Operation can not be performed",
"status": "INTERNAL_SERVER_ERROR"
}

My issue is i'm trying to apply some sort of sorting and the default Find service doesn't seem to like any where parameters such as {"id":{"$gt":4}} That gives me an error:
{
"code": "AE007",
"message": "Value for field id should be NUMBER",
"status": "BAD_REQUEST"
}

I feel like i'm doing something wrong, have spent hours looking at videos and the dev centers and can't seem to make it work.

Tavonia Evans
Posts: 0
Joined: Thu Sep 24, 2015 11:19 am

Need Help! REST APIs Using API Express

This doesn't seem to work at all for SQL

Tavonia Evans
Posts: 0
Joined: Thu Sep 24, 2015 11:19 am

Need Help! REST APIs Using API Express

I keep getting those error codes over and over

Return to “Issues”