I'm working with the OBJKT API to pull some data
Documentation - https://data.objkt.com/docs/
Explorer - https://data.objkt.com/explore/
This is my first time using GraphQL and i'm having trouble writing the syntax for the query properly:
var data = '{"query":"event(where: {creator_address: {_eq: "tz1SmSqHY1nfy4Wyw9igVow4okezFB4ztXG2"}})"}';
The error I receive is:
{"errors":[{"extensions":{"path":"$","code":"invalid-json"},"message":"Error in $: Failed reading: satisfy. Expecting ',' or '}' at 'tz1SmSqHY1nfy4Wyw9igVow4okezFB4ztXG2}})}'"}]}
I don't understand where to place the , or } .. I've tried escaping the double quotes surrounding tz1SmSqHY1nfy4Wyw9igVow4okezFB4ztXG2 but no luck
How can I send a properly formatted query?
Thanks!
try this, this should work for you
you just need to place extra pair of parenthesis inside where
var data = '{"query":"event({where: {creator_address: {_eq: "tz1SmSqHY1nfy4Wyw9igVow4okezFB4ztXG2"}}})"}';
Related
Good day,
Hope you are well.
I am trying to use the Vincere API, and trying to query the response to only return where private_job:0. I am using Postman to test the API.
When I use the below request, doing my best to follow the instructions on the Documentation:
https://domain.vincere.io/api/v2/job/search/fl=job_title,private_job;sort=published_date asc?q=private_job:0
I get the following response:
"Parse exception Unexpected end of input, expected term_char, ws0, term or term_end (line 1, pos 14):\nprivate_job:0\n ^\n"
If I remove ?q=private_job:0, I get a valid response.
I am clearly doing something wrong. Please assist.
in query parameter the key name is q ,
q=private_job:0
but in documentation it says instead of q it should be fq
https://domain.vincere.io/api/v2/job/search/fl=job_title,private_job;sort=published_date asc?fq=private_job:0
Also if you are using special character q=private_job:0 # , then give the value in the query parameter session of postman it will url encode it automatically for you
This stumped me as well, turns out my issue was twofold.
Firstly, this error refers to their URL parser expecting to see the end character %23, so your query string needs to end with that.
Secondly, I was attempting to query the job_type and using the actual string value ie. job_type:PERMANENT%23. This actually needs to be the enum value (1 in this case).
I'm trying to build a Google Query and make a request from Apps Scripts. I'm appending the query to the sheet URI like:
https://docs.google.com/spreadsheets/d/SHEET_ID/gviz/tq?sheet=Sheet1&tq=query;
The query is:
query = "SELECT N, avg(datediff(todate(G),todate(D))) " +
"GROUP BY N";
But I'm only getting an error like:
{version=0.6, errors=[{detailed_message=Invalid query: PARSE_ERROR: Encountered "(" at line 1, column 23.
Was expecting:
")" ...
, reason=invalid_query, message=INVALID_QUERY}], reqId=0, status=error}
I got this answer for handling that case calling the query from within the spreadsheets: https://productforums.google.com/d/msg/docs/Ksc-w0r8uj0/QFxiXlmzAwAJ
But I don't know how to do the same by code, as the response is in a JSONP format which kind of manually edit to only have a JSON string.
Thanks
Answering my own question. Just using the query, I couldn't find a way, but instead reading through the Data Manipulation Methods, specifically "Creating a modifier function" gives me the possibility to modify the data on the fly and then aggregate it.
https://developers.google.com/chart/interactive/docs/reference#google_visualization_data
So, I am trying to execute a query using ArcGIS API, but it should match any Json queries. I am kind of new to this query format, so I am pretty sure I must be missing something, but I can't figure out what it is.
This page allows for testing queries on the database before I actually implement them in my code. Features in this database have several fields, including OBJECTID and Identificatie. I would like to, for example, select the feature where Identificatie = 1. If I enter this in the Where field though (Identificatie = 1) an error Failed to execute appears. This happens for every field, except for OBJECTID. Querying where OBJECTID = 1 returns the correct results. I am obviously doing something wrong, but I don't get it why OBJECTID does work here. A brief explanation (or a link to a page documenting queries for JSON, which I haven't found), would be appreciated!
Identificatie, along with most other fields in the service you're using, is a string field. Therefore, you need to use single quotes in your WHERE clause:
Identificatie = '1'
Or to get one that actually exists:
Identificatie = '1714100000729432'
OBJECTID = 1 works without quotes because it's a numeric field.
Here's a link to the correct query. And here's a link to the query with all output fields included.
I keep receiving the error
"LINQ to Entities does not recognize the method 'System.String get_Item(Int32)' method, and this method cannot be translated into a store expression"
on the following line in my code
var Reviewer = repository.reviewers.FirstOrDefault(t => t.ReviewerName == formCollection[3]);
formCollection[3] is a string returned from a drop down I have contained within a form. The query seems to work O.K. until it returns the value from the database. What can I do to fix this?
OK, I was trying to do too much at once, when I finally thought about it and put formCollection[3] into a string variable and then used the string variable in the linq query everything worked out ok.
I'm trying to create a text file that contains the value of a custom field I added on redmine. I tried to get it from an SQL query in the create method of the project_controller.rb (at line 80 on redmine 1.2.0) as follows :
sql = Mysql.new('localhost','root','pass','bitnami_redmine')
rq = sql.query("SELECT value
FROM custom_values
INNER JOIN projects
ON custom_values.customized_id=projects.id
WHERE custom_values.custom_field_id=7
AND projects.name='#{#project.name}'")
rq.each_hash { |h|
File.open('pleasework.txt', 'w') { |myfile|
myfile.write(h['value'])
}
}
sql.close
This works fine if I test it in a separate file (with an existing project name instead of #project.name) so it may be a syntax issue but I can't find what it is. I'd also be glad to hear any other solution to get that value.
Thanks !
(there's a very similar post here but none of the solutions actually worked)
First, you could use Project.connection.query instead of your own Mysql instance. Second, I would try to log the SQL RAILS_DEFAULT_LOGGER.info "SELECT ..." and check if it's ok... And the third, I would use identifier instead of name.
I ended up simply using params["project"]["custom_field_values"]["x"] where x is the custom field's id. I still don't know why the sql query didn't work but well, this is much simpler and faster.