Query data from current user in arrowdb - appcelerator

how can i query the checkin from a specific user in the api? Like a join with the user and filter by the user_id? It because checkin does not have user_id property.

Just did a workaround putting the owner_id as a custom_field in the checkin creation.

You should be able to use user_id in query checkins API, like following example:
curl -c cookies.txt -b cookies.txt -X GET --data-urlencode 'where={"user_id":"56207d2616d4b1e2de4bbba8"}' "https://api.cloud.appcelerator.com/v1/checkins/query.json?key=myOwnAppKey&pretty_json=true&show_user_like=true&count=true"
{
"meta": {
"code": 200,
"status": "ok",
"method_name": "queryCheckins",
"count": 1
},
"response": {
"checkins": [
{
"id": "56e67fb3550a680912694e17",
"created_at": "2016-03-14T09:09:07+0000",
"updated_at": "2016-03-14T09:09:07+0000",
"place_id": "56e67edda778ca09086b8ff1",
"user_id": "56207d2616d4b1e2de4bbba8"
}
]
}
}

Related

curl request says to address needs to be an array when it already is?

I'm trying to send an email out using Mandrill by adapting the curl command from https://mailchimp.com/developer/transactional/api/messages/send-new-message/ and using the API key from https://us1.admin.mailchimp.com/account/api/ and I'm getting an error that doesn't make a lot of sense to me. Here's the command I'm running:
curl -X POST \
https://mandrillapp.com/api/1.0/messages/send \
-d '{"key":"...","message":{"html":"hello, world!","subject":"hello, world!","from_email":"neubert#neubert.com","to":["neubert#neubert.com"]}}'
Here's the response:
{"status":"error","code":-2,"name":"ValidationError","message":"Validation error: {\"message\":{\"to\":[\"Please enter an array\"]}}"}
Here it is decoded:
{
"status": "error",
"code": -2,
"name": "ValidationError",
"message": "Validation error: {\"message\":{\"to\":[\"Please enter an array\"]}}"
}
I don't understand. "to" is an array...
Any ideas?
Thanks!
I also got the same error at first then going through the documentation keenly, I noticed that the to field in message is NOT a list of email addresses. I know it's intuitive that way!!
It's a list of object's with 3 fields: email, name and type.
An ideal JSON Body will be as follows:
{
"key": "<YOUR_MANDRILL_API_KEY>", # Caution! It is not a mailchimp API key
"message": {
"html": "testing html part",
"text": "testing text part",
"subject": "testing subject",
"from_email": "<FROM_EMAIL_ADDRESS>",
"from_name": "<FROM_NAME>",
"to": [
# Recipient 1
{
"email": "<Recipient1_EMAIL_ADDRESS>",
"name": "<Recipient1_NAME>"
},
# Recipient 2
{
"email": "<Recipient2_EMAIL_ADDRESS>",
"name": "<Recipient2_NAME>"
}
]
}
}

Pullrequest to Bitbucket

I am looking to send pull request to multiple reviewers in bitbucket. Currently I have json and curl request as below
{
"title": "PR-Test",
"source": {
"branch": {
"name": "master"
}
},
"destination": {
"branch": {
"name": "prd"
}
},
"reviewers": [
{
"uuid": "{d543251-6455-4113-b4e4-2fbb1tb260}"
}
],
"close_source_branch": true
}
curl -u "user:pass" -H "Content-Type: application/json" https://api.bitbucket.org/2.0/repositories/companyname/my-repo/pullrequests -X POST --data #my-pr.json
The above curl command works. I need the json syntax to pass either multiple usernames or multiple UUID in the reviewers list.
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests
The documentation you linked to seems to indicate that something like this should work:
"reviewers": [
{
"uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}"
},
{
"uuid": "{bafabef7-b740-4ee0-9767-658b3253ecc0}"
}
]

Elasticsearch sorting by relationship

I've defined relationship like this
PUT /my_index/user/1
{
"name": "John Smith",
"email": "john#smith.com",
"dob": "1970/10/24"
"number_of_posts": 4
}
PUT /my_index/blogpost/2
{
"title": "Relationships",
"body": "It's complicated...",
"user": 1
}
How can I sort blogpost by user information like name, email or number_of_posts without using nested field on blogpost, because I don't want to update all blogpost with user = 1 when user change their information. Thanks!

YQL console gives me result but rest query gives me error

I'm trying to use YQL Console to get currency rates, the YQL statement is
select * from yahoo.finance.xchange where pair in ("EURUSD","GBPUSD")
the console results give me
{
"query": {
"count": 2,
"created": "2017-10-26T02:42:44Z",
"lang": "en-US",
"results": {
"rate": [
{
"id": "EURUSD",
"Name": "EUR/USD",
"Rate": "1.1829",
"Date": "10/26/2017",
"Time": "3:42am",
"Ask": "1.1829",
"Bid": "1.1829"
},
{
"id": "GBPUSD",
"Name": "GBP/USD",
"Rate": "1.3269",
"Date": "10/26/2017",
"Time": "3:42am",
"Ask": "1.3269",
"Bid": "1.3269"
}
]
}
}
}
but the rest query gives me error
{"error":{"lang":"en-US","diagnostics":{"cache":{"execution-start-time":"0","execution-stop-time":"0","execution-time":"0","method":"GET","type":"MEMCACHED","content":"ENV.queryyahooapiscomproductionsg3.store://datatables.org/alltableswithkeys.15a841ff462a38eb6175e73b4dc747ef"},"env":"Failed to read from storage: store://datatables.org/alltableswithkeys: Invalid store url: store://datatables.org/alltableswithkeys","warning":"Invalid environment specified: store://datatables.org/alltableswithkeys"},"description":"No definition found for Table yahoo.finance.xchange"}}
The yahoo.finance.xchange is a community table. In the YQL console there should be a checkbox saying Show Community Tables select that and you should have access to it. The REST call here works. Let me know if you have any questions.

Search query on Okta Users API

I am trying to run a query in our instance of okta using postman. The problem I am running into is that Postman says it has syntax errors. Exact wording "Invalid search criteria.". Here is a partial copy copy of my structure:
{
"id": "00u1c9lvdpsArq00J0h8",
"status": "ACTIVE",
"created": "2017-02-28T18:55:23.000Z",
"activated": "2017-02-28T18:55:24.000Z",
"statusChanged": "2017-02-28T18:55:24.000Z",
"lastLogin": null,
"lastUpdated": "2017-05-01T10:30:59.000Z",
"passwordChanged": null,
"profile": {
"login": "lynn#enterthepicture.com",
"firstName": "Lynn",
"lastName": "Harvey",
"mobilePhone": null,
"email": "lynn#enterthepicture.com",
"secondEmail": null,
"primaryPhone": "4169329890"
},
"credentials": {
"provider": {
"type": "ACTIVE_DIRECTORY",
"name": "idm.sni"
}
},
The query I am trying to run is {{url}}/api/v1/users?search=credentials.provider.name eq "idm.sni"
If anyone has any suggestion I would greatly appreciate the help.
The search expression needs to be URL encoded, an example can be found here: http://developer.okta.com/docs/api/resources/users.html#list-users-with-search
So in your example, the request URL would need to look like {{url}}/api/v1/users?search=credentials.provider.name%20eq%20%22idm.sni%22.
I hope this helps!

Resources