I am trying to make a GeoJSON query work as per the Eve documentation (v0.6.1-dev): http://python-eve.org/features.html
However, the query in postman returns an error:
Postman GET: http://localhost:5000/people?where={"location": {"$near": {"$geometry": {"type":"Point", "coordinates": [10.0, 20.0]}, "$maxDistance": 1000}}}
Error:
500 Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
The 'people' collection contains the location as show below:
Postman GET: http://localhost:5000/people
"_items": [
{
"_updated": "Wed, 30 Sep 2015 10:26:51 GMT",
"firstname": "John",
"lastname": "Doe",
"born": "Thu, 27 Aug 1970 14:37:13 GMT",
"role": [
"author"
],
**"location": {
"type": "Point",
"coordinates": [
100,
0
]
},**
"_links": {
"self": {
"href": "people/560bb8eb6adf7d0e70f26cd0",
"title": "person"
}
},
Any idea why this does not work ?
Try to switch on debug mode (set DEBUG = True in settings) and see what the actual error is. It is very likely that there is no geo index for the field (Eve does not automatically create indexes for you).
UPDATE: Starting with v0.6, you can also ask Eve to maintain the index for you, see the mongo_indexes keyword in the docs
Related
We use MSgraph and EWS API for our products.
When we do changes in our test Microsoft 365 environment (Add/change/delete - roomlists and rooms) we see the changes immediately when testing with EWS Editor.
But it takes up to 48 hours before we se the changes by using MSgraph Explorer.
I would guess that this is not expected behavior?
We understand it might take some time (Up to 30 minutes) but up to 48 hours?
Our test environment is a pure Microsoft 365 tenant (No hybrid)
The MSgraph API calls we test is:
GET /places/microsoft.graph.room and GET /places/microsoft.graph.roomlist
It seems that this issue might have been introduced after our environment was moved to the Norwegian datacenter.
No error messages from MSgraph, all seems normal..
Here is the results from MSgraph when i ask for roomlist:
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#places/microsoft.graph.roomList",
"value": [
{
"id": "32d75744-113e-4bec-91c4-811623d11521",
"displayName": "Test2",
"address": null,
"geoCoordinates": null,
"phone": "",
"emailAddress": "Test2#loop24.no"
},
{
"id": "1d535e8b-c44d-498a-9046-dbbe1ae3be75",
"displayName": "TestList",
"address": null,
"geoCoordinates": null,
"phone": "",
"emailAddress": "testlist#loop24.no"
},
{
"id": "b9ea8bd6-32da-4d6d-b38e-db6c03f4fa54",
"displayName": "RoomList",
"address": null,
"geoCoordinates": null,
"phone": "",
"emailAddress": "roomlist#loop24.no"
Here is the results from EWSEditor (This is correct)
Call Get Roomlist roomlist#loop24.no Roomlist
According to the docs, when Twilio receives a message from a Twilio numbers it makes a synchronous HTTP request to the message URL configured for that number. Twilio sends the the parameters listed at https://www.twilio.com/docs/api/twiml/sms/twilio_request
Is it possible to have the date/time sent and/or received passed to the configured URL as well, and if so, how?
Dates and Times are addressed as such and are attached to the messages resource.
{
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"api_version": "2010-04-01",
"body": "Hey test message",
"error_code": null,
"error_message": null,
"num_segments": "1",
"num_media": "0",
"date_created": "Mon, 16 Aug 2010 03:45:01 +0000",
"date_sent": "Mon, 16 Aug 2010 03:45:03 +0000",
"date_updated": "Mon, 16 Aug 2010 03:45:03 +0000",
"direction": "outbound-api",
"from": "+14158141829",
"price": "-0.02000",
"sid": "MMXXXXXXXXXXXXXXXXXXXXXXXXX",
"status": "sent",
"to": "+15558675309",
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/MMXXXXXXXXXXXXXXXXXXXXXXXXXXXec.json"
}
I need to know how to query the following invoke(AC(123456A)or (user_type1_c19a5f0b7e) when i have init this:
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "https://github.com/johndoe/learn-chaincode/finished"
},
"ctorMsg": {
"function": "init",
"args": [
"hi there"
]
},
"secureContext": "user_type1_191b8c2993"
},
"id": 1
}
Here is my (successful) invoke:
{
"jsonrpc": "2.0",
"method": "invoke",
"params": {
"type": 1,
"chaincodeID": {
"name": "b42b506c13fg1157520d585841a691f4b598d9aac53adc95277ed710c7f1f5aaa59a89a8dca8ddf3e46d5241562f3316956a04ad8a33181d30cb01b1c4c9adb2f"
},
"ctorMsg": {
"function": "AC(123456A)",
"args": [
"AcctId:949392949233 ","Year2015 Sem1 ", "IT1234:A ", " IT2345:B+ ", "IT3456:A ", "Year 2015 Sem2 ", "IT4567:B ", "IT5678: B", "IT5678:A ","Year 2016 Sem1 ", "IT6789:C ", "IT7890:C ", "Cumulative GPA: 3"
]
},
"secureContext": "user_type1_c19a5f0b7e"
},
"id": 4
}
Here is the query that I am trying and I can't get the results that I want:
{
"jsonrpc": "2.0",
"method": "query",
"params": {
"type": 1,
"chaincodeID": {
"name": "b42b506c13fg1157520d585841a691f4b598d9aac53adc95277ed710c7f1f5aaa59a89a8dca8ddf3e46d5241562f3316956a04ad8a33181d30cb01b1c4c9adb2f"
},
"ctorMsg": {
"function": "AC(123456A)",
"args": [
"AcctId:949392949233 "
]
},
"secureContext": "user_type1_c19a5f0b7e"
},
"id": 2
}
Here's the response for the query.
{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Query failure",
"data": "Error when querying chaincode: Error:Transaction or query returned with failure: Received unknown function query"
},
"id": 2
}
Right now, I am trying out this tutorial, which is provided by IBM Bluemix:
https://github.com/IBM-Blockchain/learn-chaincode.
I have tried an init using their example and do invoke(successful) to suit my needs. I tried the Bluemix tutorial, which I mentioned earlier, and I am able to achieve what is stated in the documentation. Therefore, I decided to invoke something to suit my own needs. However, i am unable to query the person AC(123456A) or user_type1_c19a5f0b7e with showing of items such as "Year2015 Sem1", "IT1234:A", "IT3456:B+ " and etc . How can I query (the invoke) to suit my own needs?
Our understanding is that you are using an IBM Blockchain Starter Developer Network on IBM Bluemix. Using this environment, the "Learn Chaincode" tutorial (https://github.com/IBM-Blockchain/learn-chaincode) has been followed. We would like to confirm our understanding of your results when following the tutorial. Our understanding is that when following the tutorial, the Init, Invoke, and Query chaincode functions all operated as expected. Is the understanding correct that the tutorial as written could be followed successfully?
Then we understand that the example chaincode was modified to apply different logic. The Invoke for this modified chaincode that uses the AC(123456A) function with a user of user_type1_c19a5f0b7e appears to have been successful. However, a query that also used the AC(123456A) function was not successful. Is this understanding correct?
Could some additional details be provided so this can be considered further?
Did you write your own customized chaincode? If so, could this chaincode (including the AC(123456A) function definition) be provided?
Is the AC(123456A) function located in the same Go source file as the rest of the chaincode?
We imagine that the user named user_type1_c19a5f0b7e was registered since the Invoke did work. Were steps to register this user followed as noted in the "Secure Enrollment" section of the "Learn Chaincode" tutorial?
Can the AC(123456A) function both write values to the ledger (through the Invoke) and read values from the ledger (as is being attempted through the Query)?
I have retrieved a json object using typhoeus gem.
url = 'www.example.com' <br>
request = ::Typhoeus::Request.get(url,userpwd: username + ":" + pass)<br>
content = JSON.parse(request.body)
I would like to count the occurence of "Priority":"high" including the quotes inside the json response. How do I go about doing this?
Edit:
"priority":"high" is a key value pair. It is deeply nested inside the json tree.(Don't how deeply it is nested). All I need is count of occurence of "priority":"high"
Any and all suggestion is welcome.
Sample data:
"tickets": [{
"url": "https://.zendesk.com/api/v2/tickets/xxxx.json",
"id": xxxxx,
"external_id": null,
"via": {
"channel": "email",
"source": {
"from": {
"address": "#compli.com",
"name": ""
},
"to": {
"name": "organization Global Support",
"address": "support#organization.zendesk.com"
},
"rel": null
}
},
"created_at": "2016-08-04T16:23:13Z",
"updated_at": "2016-08-08T20:26:01Z",
"type": "problem",
"subject": "Problems with abc Connect",
"raw_subject": "Problems with abc Connect",
"description": "Hi – our Tenet ID is 5675.\n\n \n\nThe abc report is not providing the full data when I run the billing preview. I am running it using Chrome. Attached are snapshots of what I’m doing plus the report generated.\n\n \n\nA perfect example of the problem is shown at the bottom of the report generated. Garber Automotive Group, account number A00000490 does not display the data for all of their products. Their data is shown on rows 5658 thru 5712 on the excel file BillingPreviewResult_201620 report run 08.04.16.\n\n \n\nHowever the EXACT same report (all the parameters are the same) run on 07/01/16 included all of Garber’s information. The excel file abc report run 07.01.16 10.13 AM has the data for Garber on rows 6099 – 6182.\n\n \n\nThe report is cutting off a lot of data for some reason. As you can see by comparing the amount of data between the two excel reports there are much fewer lines on the report run on today as opposed to the one run on 07/01, 6182 rows vs 5712 rows.\n\n \n\nThis is a business critical report for us. It is used for cash forecasting, monthly financial reporting, rolling budgeting and ad hoc reporting.\n\n \n\nWe need this problem identified and fixed immediately. It is already causing a problem with finalizing our July results.\n\n \n\nLet me know if you have any questions or need any additional data.\n\n \n\n \n\nRegards,\n\n \n\n \n\n \n\n| Controller\ndesk: 503.963-4239 | fax: 503.294.1200 | \n\nCompli - Cool, Calm and Compliant. TM\n\nVisit() to learn more.\n\n \n\nFollow us on LinkedIn () and Twitter",
"priority": "normal",
"status": "open",
"recipient": "support#organization.zendesk.com",
"requester_id": 1336424406,
"submitter_id": 1336424406,
"assignee_id": null,
"organization_id": 224504969,
"group_id": 21606503,
"collaborator_ids": [560973773, 786229209, 421597631, 539566717, 707192615, 1336424406, 31365392, 719608577, 1817633993],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"due_at": null,
"tags": ["1_price", "best_practice_advise", "engage_global_services__email_", "escalate", "hard", "internal_escalation", "p0", "yes_escalated", "xxxxx", "zhub"],
"custom_fields": [{
"id": 22024091,
"value": "p0"
}, {
"id": 24212576,
"value": "best_practice_advise"
}, {
"id": 22035048,
"value": "xxx and so on.....
I'm trying to find a way to just get tweets to all users. The JSON code indicates these as "to_user" null. For example the tweet below edent tweets to everyone, thus the to_user=null.
I tried a few alternatives without success:
http://search.twitter.com/search.json?q=to:null%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:0%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:%20from:edent&result_type=mixed
{
"created_at": "Thu, 28 Jun 2012 06:55:58 +0000",
"from_user": "edent",
"from_user_id": 14054507,
"from_user_id_str": "14054507",
"from_user_name": "Terence Eden",
"geo": null,
"id": 218236278402068480,
"id_str": "218236278402068480",
"iso_language_code": "en",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://a0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"source": "<a href="http://twitter.com/">web</a>",
"text": "RT #straczynski: #edent Clearly the man was ahead of his time.",
"to_user": null,
"to_user_id": 0,
"to_user_id_str": "0",
"to_user_name": null,
"in_reply_to_status_id": 218075066452287500,
"in_reply_to_status_id_str": "218075066452287488"
},
If you're just looking to get tweets from a particular user that aren't to anyone, use the /get/statuses/user_timeline REST API endpoint instead of the Search API. /get/statuses/user_timeline has an exclude_replies parameter that should do what you're looking for.
The Search API doesn't have any way to exclude replies. Your only option is to get tweets matching whatever other parameters you pass, and process them on your end to remove any whose text starts with "#".