1

I am developing a Meteor web app that uses a public API.

I am having trouble constructing a query string that can use the 'LIKE' operator as in SQL or SOQL.

I want to make the call like this:

$.getJSON( api_url, function( data ) {
                $.each( data, function( key, val ) {
                    ... do stuff ...
    }
}

where api_url is a string that has been concatenated. This works fine:

 https://opendata.miamidade.gov/resource/dj6j-qg5t.json?case_owner=Animal_Services

However, suppose instead of Animal_Services I want to search for a pattern on the case_owner field. I want to effectively search for all rows where case_owner begins with "Public_Works"

The pseudocode might be something like this:

SELECT * from Table WHERE case_owner LIKE '%Public_Works%'

This is mostly a matter of syntax, but I am not sure how to proceed. I have checked the JQuery documentation for the $.getJSON method, and also looked at some SOQL threads on the SalesForce developer forums. However, for the constraints of this project, it must be a string entered with $.getJSON

I am using Meteor, if that matters. If anybody could point me in the right direction, that would be very helpful. I am finding it difficult to search for answers because the concerned operator is 'LIKE' which is not a very powerful search term on Google.

0

1 Answer 1

1

i actually checked the documentation of opendata.miamidade and you can do a wide variety search with $q

var search = 'Public'; //will return everything that have public 
var url = "https://opendata.miamidade.gov/resource/dj6j-qg5t.json?$q=" + search;

check the documentation they have many functions that you might want to look.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.