Unable to call Azure Management Events REST API - api

I am trying to use the rest api found here: https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx to get the azure events from my subscription. I have followed the instructions very carefully, but my GET requests return a 400 error:
{"Code":"BadRequest","Message":"The $filter query parameter value is invalid."}
My cURL request can be seen below. I've redacted any private info
curl -X GET -H "Authorization: bearer XXX" -H "content-type: application/json" "https://management.azure.com/subscriptions/YYY/providers/microsoft.insights/eventtypes/management/values?api-version=2014-04-01&$filter=eventTimestamp%20ge%20%272016-07-25T22:00:37Z%27%20and%20eventTimestamp%20le%20%272016-07-25T23:36:37Z%27%20and%20eventChannels%20eq%20%27Admin,%20Operation%27"
I have tried many variations of the filter param, but I think this should be correct. Each space was replaced with a %20, and each ' was replaced with a %27.
If anyone can please inform me as to what the correct query should look like i'd really appreciate it!
Thanks!

Please try to change the double quotes over the url to the single quotes. And it works fine on my side after modification.
E.G.,
curl -X GET -H 'Authorization: bearer <token>' -H 'content-type: application/json' 'https://management.azure.com/subscriptions/XXX/providers/microsoft.insights/eventtypes/management/values?api-version=2014-04-01&$filter=eventTimestamp%20ge%20%272016-07-25T22:00:37Z%27%20and%20eventTimestamp%20le%20%272016-07-25T23:36:37Z%27%20and%20eventChannels%20eq%20%27Admin,%20Operation%27'

Related

Add two separate messages with circuit rest api in the same subject box

I am trying to write two different messages to the same subject bot after each other. But any time a new subject with the same title is posted.
I use the rest api post call and tried this:
curl --insecure -X POST https://yourcircuit.com/rest/v2/webhooks/incoming/xxxx -d '{"text": "foobar1", "subject": "My fancy title"}'
curl --insecure -X POST https://yourcircuit.com/rest/v2/webhooks/incoming/xxxx -d '{"text": "foobar2", "subject": "My fancy title"}'
I assumed two messages under the same title box inside the circuit conversation.
What is shows:
What I want to achive:
Does anybody know how to achive this?
That is not supported with webhooks. This could be done with the regular REST API /conversations/{convId}/messages/{itemId}. See https://circuitsandbox.net/rest/v2/swagger/ui/index.html
You can try this using the swagger ui at https://circuitsandbox.net/rest/v2/swagger/ui/index.html
Here is the corresponding http request:
curl -X POST "https://circuitsandbox.net/rest/v2/conversations/05bd75f1-a8d5-40c0-b24a-28710ec1a57f/messages/cde0b57e-7f1d-4ffb-b2af-a1b7c7c9fa06" \
-H "accept: application/json" \
-H "authorization: Bearer ot-4f70c19edc6f43c4b89b4d39b4440000" \
-H "content-type: application/x-www-form-urlencoded" \
-d "content=hello"
Note that the token above has been invalidated. You need to use your own conversation ID, parent item ID and access token.
And here is how it looks in Circuit:

Using cURL in API where a Date Array is required

I'm trying to create a simple cURL request to grab some JSON data and dump it into a file. Tried using command-line and PowerShell but can't
figure out how to use a date array as required in the documentation (https://api.officevibe.com/docs/engagement)
The support at OfficeVibe is ridiculous, unless you know exactly what you're doing they're not very willing to help and any examples provided don't actually work (as i'm assuming they need to be part of a larger app).
Can anyone offer some advice on how i can get this working? (The Bearer ID isn't our actual ID)
Example from OfficeVibe which doesn't work in command-line or PowerShell:
c:\temp\curl.exe -k -X POST https://app.officevibe.com/api/v2/engagement -H 'Authorization: Bearer 1234' -H 'Content-Type: application/json' -d '{"dates" : ["2019-04-01"]}' -o c:\temp\engagement.json
Many thanks
The answer was as easy - all i needed to do was add a backslash before the double-quote:
c:\temp\curl.exe -k -X POST https://app.officevibe.com/api/v2/engagement -H 'Authorization: Bearer 1234' -H 'Content-Type: application/json' -d '{\"dates\" : [\"2019-04-01\"]}'

How to get a Yelp access token

I am trying to use the yelp fusion api but cannot seem to find out how to format the url. I have read the get started page but do not understand it. I just need to know where to put what. This is what I have so far:
https://api.yelp.com/oauth2/token?grant_type=client_credentials&client_id=ID&client_secret="CLIENT SECRET"
When I load this url it says "VALIDATION_ERROR." What am I doing wrong?
The grant_type,client_id and client_secret should be sent in application/x-www-form-urlencoded format in the POST call.
curl -X POST \
https://api.yelp.com/oauth2/token \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET'

Wunderlist Api Update Reminder error

I want update reminder for task in Wunderlist.
Use Wunderlist Api:
curl -H "Content-Type: application/json" -H "X-Access-Token: xxx" -H "X-Client-ID: xxx" a.wunderlist.com/api/v1/reminders/12345 -X PATCH -d {"revision":1,"date":"2015-11-25T16:49:23"}
and response:
{"error":{"type":"not_found","translation_key":"api_error_not_found","message":"The
resource you requested could not be found."}}
For your curl request, the server is actually seeing this as parameter
{revision:1,date:2015-11-25T16:49:23}
But I think your valid json should be:
{"revision":1,"date":"2015-11-25T16:49:23"}
So the valid parameter from your curl should be as below with wrapped inside quote. I used double quote by assuming that you are doing from windows. If from unix, you can easily use single quote for the wrapping!
-d "{\"revision\":1,\"date\":\"2015-11-25T16:49:23\"}"

curl -h or curl --header not working

i'm trying to connect ti a web api service, box-api, and following the tutorial i have to type this command to fetch a folder in the user content:
curl https://api.box.com/2.0/folders/FOLDER_ID/items?limit=2&offset=0 -H "Authorization: Bearer ACCESS_TOKEN"
I tryied to connect from the command line to test the command but it keep complaining about the -H or the --header command saying that it doesn exist:
-bash: -H: command not found
-bash: --header: command not found
but when i type curl --help the command is in the manual:
-H, --header LINE Custom header to pass to server (H)
I'm confused, what should i do to connect to this site and get the JSON content? Thanks
Your url has & sign. and this is making end of command on there(and running at background). You can remove this error by using quotes around. Like this
curl "https://api.box.com/2.0/folders/FOLDER_ID/items?limit=2&offset=0" -H "Authorization: Bearer ACCESS_TOKEN"
Hope this helps.
There seem to be two problems:
The '&' in the middle of the URL passed to curl,
The order of the statements. The curl manual reports a different order for the statements. Example:
curl -H "Authorization: Bearer AUTH_KEY" "https://api.box.com/2.0/folders/0/items?limit=2&offset=0"
This should be the complete solution.