I have SendGrid response and here I get individual X-MessageID which is unique for all sent email, this X-MessageID is actually a starting position of Sendgrid MessageID. So here I was doing something like this "Sendgrid_MessageID Start with X-MessageID",
For.Ex 'KdLh1ZETSQCWx0iqU44BTg.filterdrecv-75d94df84d-4c444-1-627963D1-45.3' start with 'KdLh1ZETSQCWx0iqU44BTg'. I have done this using SendGrid "like" operator like this =>
msg_id like 'KdLh1ZETSQCWx0iqU44BTg%'
and also try another option like
query=msg_id like 'KdLh1ZETSQCWx0iqU44BTg%'
But I get error 'invalid value' for both option, I don't undertstand how to use it. Anyone knows about how to use this "like" operator?
You are using the like operator correctly.
When I make the following HTTP GET request using cURL, I get the message back that start with the given ID:
curl -X GET https://api.sendgrid.com/v3/messages \
--header "Authorization: Bearer [SENDGRID_API_KEY]" \
--data-urlencode "query=msg_id LIKE 'W86EgYT6SQKk0lRflfLRsA%'" \
--data-urlencode "limit=10" --GET
How are you making this HTTP request?
I think this might be a simple quote escape issue, but can’t figure it out.
I am trying to update a microsoft planner task using CURL with REST API. I can CREATE tasks (from a custom application called FileMaker to Microsoft Planner using Microsoft Graph API) without issue, but when I try to UPDATE a planner task, I get an error that "The If-Match header must be specified for this kind of request." But I am including the If-Match header, just might not be entering it correctly.
The URL is:
"https://graph.microsoft.com/v1.0/planner/tasks/" & $microsoftplannerTaskID
The CURLOPTIONS, I am entering within FileMaker is ...
"-X PATCH " &
" -H "Authorization: Bearer " & $$userToken & """ &
" -H "Content-Type: application/json"" &
" -H "If-Match: " & $microsoftPlannerTasketag & """ &
" -d #$PlannerTaskDetails"
ENDS UP LOOKING LIKE THIS …
-X PATCH -H "Authorization: Bearer wEXu<>k_QQY" -H "Content-Type: application/json" -H "If-Match: W/"JzEtVGFzayAgQEBAQEBAQBAQEBARCc="" -d #$PlannerTaskDetails
When I CREATE the task initially, the response show …
"#odata.etag":"W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""
Which I am using in the cURL header above. BUT … I am stripping the W/ and the quotes. The W/ means it is a “weak”, and I assume we don’t include that in the PATCH header, but I did try adding it anyway with no success.
Here is Microsoft’s UPDATE PLANNERTASK reference …
https://learn.microsoft.com/en-us/graph/api/plannertask-update?view=graph-rest-1.0&tabs=http
I can update tasks using POSTMAN without issue, but I dont know what their header looks like when it sends the request.
I can get it to work in Postman and in there I have entered for the Plan ETag variable this …
W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="
I notice in postman the header shows etag is
W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="
And the body returns as
"#odata.etag": "W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="",
It’s got to be a simple syntax issue with my curloption variable, but I can’t figure it out.
I also tried removing the W/ in the If-Match header, so it looks like this:
-H "If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""
And the extra quotes in the If-Match header, so it looks like this:
-H "If-Match: JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="
All of these result in the same “if-match” error.
One interesting thing …if I change the If-Match to include a slash in front of the quotes
-H "If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""
I get an error 10 “requested data is missing” in Filemaker’s script debugger and no response from the insert from url statement. Makes sense though, since it is reading this as “if-match: ”
And same thing if I add the W/ back in
-H "If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""
Gives me error 10 as well
If you have any thoughts, I would greatly appreciate your help!!
Try this:
"-X PATCH " &
"-H " & quote("Authorization: Bearer " & $$userToken) &
"-H " & quote("Content-Type: application/json") &
"-H " & quote("If-Match: W/" & quote($microsoftPlannerTasketag)) &
"-d #$PlannerTaskDetails"
I am having an issues with thingsboard professional edition.
I am using HTML Server Side RPC API.
Basically what I am trying to do is load dashboard and update knob temperature value. The next step is to set temperature value using knob and send it to device.
Issue with getValue method
First of all I open dashboard and I am sending GET request
curl -v -X GET https://cloud.thingsboard.io/api/v1/*Device Access/Token*/rpc
Response is:
{"id":241,"method":"getValue","params":null}*
So I respond:
curl -v -X POST -d "{"result":44}" https://cloud.thingsboard.io/api/v1/*Device Access Token*/rpc/241 --header "Content-Type:application/json"
In place of "{"result":44}" I tried (I think) all possibilities like:
"{"method":"getValue","params":44}"
"{"method":"setValue","params":44}"
"{"method":NULL,"params":44}"
"{NULL,44}"
"44"
"{44}" and so on...
Can somebody help me how should proper response look like to update knob value when dashboard loads?
2) setValue issue
When I am trying to change temperature value I noticed that there is something weird happening.
Let's say that I want to change value from 50 to 80deg using knob.
If i just "click" and temperature is set somewhere about 80deg when I send GET message response is what i expect:
{"id":273,"method":"setValue","params":"81.37"}*
But when I click on knob and slide the value from 50deg to 80deg and release the button I don't have proper response. Most of the time I have response like that:
{"id":275,"method":"setValue","params":"50.00"}* Closing connection 0
Or very close to 50 deg and it doesn't change anymore. How can i fix that issue?
Even though this is more than 2 years old, I think it might help someone never the less:
Regarding GetValue I did many experiments and found that the POST message does not need
--header "Content-Type:application/json"
and the return value does not need to be in JSON format, but just plain text. So if you use
--header "Content-Type:application/text"
and as a return value just send e.g.
40.0
it will be accepted by the knob control.
full command might be something like
curls -v -X POST -d 40.0 https://cloud.thingsboard.io/api/v1/*Device Access Token*/rpc/241 --header "Content-Type:application/text"
I'm trying to collect smartctl metrics and push them into influxdb. I'm having difficulty adding tags for values being pushed in so that the tags and values are in the right place.
If I do this:
curl -POST 'http://localhost:8086/write?db=test' --data-binary 'smartctl Raw_Read_Error_Rate=19243395i,Spin_Up_Time=0i,Start_Stop_Count=149i,Reallocated_Sector_Ct=25i,Seek_Error_Rate=4735843653i,Power_On_Hours=41286i,Spin_Retry_Count=0i,Power_Cycle_Count=150i,End_to_End_Error=0i,Reported_Uncorrect=0i,Command_Timeout=12885098501i,High_Fly_Writes=0i,Airflow_Temperature_Cel=29i,G_Sense_Error_Rate=0i,Power_Off_Retract_Count=145i,Load_Cycle_Count=25668i,Temperature_Celsius=29i,Hardware_ECC_Recovered=19243395i,Current_Pending_Sector=0i,Offline_Uncorrectable=0i,UDMA_CRC_Error_Count=0i 1472412282915653274'
There are no tags:
SHOW TAG KEYS FROM "smartctl" (empty result)
How do I add tags to that same curl command so that I get something like:
host=foo,disk_name="Seagate Blah"
Adding some clarification:
If I use a comma (and set a value), then they are all tags, not fields:
curl -POST 'http://localhost:8086/write?db=test' --data-binary 'smartctl,Raw_Read_Error_Rate=19243395i,Spin_Up_Time=0i,Start_Stop_Count=149i,Reallocated_Sector_Ct=25i,Seek_Error_Rate=4735843653i,Power_On_Hours=41286i,Spin_Retry_Count=0i,Power_Cycle_Count=150i,End_to_End_Error=0i,Reported_Uncorrect=0i,Command_Timeout=12885098501i,High_Fly_Writes=0i,Airflow_Temperature_Cel=29i,G_Sense_Error_Rate=0i,Power_Off_Retract_Count=145i,Load_Cycle_Count=25668i,Temperature_Celsius=29i,Hardware_ECC_Recovered=19243395i,Current_Pending_Sector=0i,Offline_Uncorrectable=0i,UDMA_CRC_Error_Count=0i value=0 1472412282915653274'
(side note: I also don't see what I would set as a value for "smartctl"?)
What I need is to set all of the above as a field, but with tags so I can determine the host they are reporting from. So I can do something like:
select Temperature_Celsius from smartctl where host=foo
Put your tags just after measurement name, separated with comma, full line protocol definition is like that:
measurement,tag1=foo,tag2=bar value_a=1,value_b=2 timestamp
So in your case:
curl -POST 'http://localhost:8086/write?db=test' --data-binary 'smartctl,host=foo,disk_name="Seagate Blah" Raw_Read_Error_Rate=19243395i,Spin_Up_Time=0i,Start_Stop_Count=149i,Reallocated_Sector_Ct=25i,Seek_Error_Rate=4735843653i,Power_On_Hours=41286i,Spin_Retry_Count=0i,Power_Cycle_Count=150i,End_to_End_Error=0i,Reported_Uncorrect=0i,Command_Timeout=12885098501i,High_Fly_Writes=0i,Airflow_Temperature_Cel=29i,G_Sense_Error_Rate=0i,Power_Off_Retract_Count=145i,Load_Cycle_Count=25668i,Temperature_Celsius=29i,Hardware_ECC_Recovered=19243395i,Current_Pending_Sector=0i,Offline_Uncorrectable=0i,UDMA_CRC_Error_Count=0i 1472412282915653274'
See also: https://docs.influxdata.com/influxdb/v1.6/write_protocols/line_protocol_tutorial/
You have an space after measurement 'smartctl' instead of ','. Try:
curl -POST 'http://localhost:8086/write?db=test' --data-binary 'smartctl,Raw_Read_Error_Rate=19 value=0.64 1472412282915653274'
Documentation indicates :
The HTTP API is the primary means of putting data into InfluxDB. To write data send a POST request to the /write endpoint. The example below writes a single point to the mydb database. The data consist of the measurement cpu_load_short, the tag keys host and region with the tag values server01 and us-west, the field key value with a field value of 0.64, and the timestamp 1434055562000000000.
curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'
I am trying to post a file to webservice with curl and with a content type of "multipart/form-data" and can't get it working. I guess my my problem is that I have parameters in the url.
../fileuploader.ws?aId=579&eId=226
curl -u user:password -F -binary-data=#test.pdf "http://localhost/fileuploader.ws?aId=579&eId=226"
I am getting error that my request is missing parameters aId and eId. I have also tried with single quotes with the same result. All the topics and discussions says that using quotes should work, but it seems like using quotes with url doesn't have effect.
The behavior depends on your shell envt. Try to escape & with \& with/without the quotes (single or double)