Telit GE910 SSL protocol with Firebase - ssl

I'm making a project with Arduino and a Telit GE910 QUAD V3 GPRS board, I want to datalog in Firebase but I'm having problems, I cannot use external libs to make http requests because I have to follow the GPRS AT commands syntax. Do you think is possible to have a workaround for SSL protocol?
my main problem is that the certificate is too big and this protocol seems too heavy for my ATMEGA328P-MU.
thanks a lot!

Use the REST API to make HTTPS requests directly to the Firebase API.
For example, I can perform a POST request to https://<instance>.firebaseio.com/path/to/data.json to write data, and a GET request to the same URL to read it back.
You can try this out from the command line using a demo server:
> curl -X PUT -d '{ "first": "Michael", "last": "Wulf" }' https://sample-rest-endpoint.firebaseio-demo.com/users/kato/name.json
> curl https://sample-rest-endpoint.firebaseio-demo.com/users/kato/name.json

Related

Is it possible to upload directly to Cloudflare stream from private link?

Is it possible to use a private video link from a cloud provider storage or from Slack (using user token) and upload them to cloudflare steam the same as this sample public link?
Based on Cloudflare documentation, (but this is for a public link)
If you have videos stored in a cloud storage bucket, you can simply pass a HTTP link for the file. Stream will fetch the file and make it available for streaming.
By using webhooks you can receive a notification when the video is ready to be played or if it errors.
Step 1: Make an API call with the link
Make a HTTP request to the Stream API with the URL of the video.
curl -X POST -d '{"url":"https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4","meta":{"name":"My First Stream Video"}}'
\ -H "Authorization: Bearer <API_TOKEN>"
\ https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/copy
Ah, seems public is the only way.
Here it said the server must be publicly routable and support HTTP HEAD requests and HTTP GET range requests. The server should respond to HTTP HEAD requests with a content-range header that includes the size of the file.
"https://example.com/myvideo.mp4"
Cloudflare API only accepts a URL for source, and there is no way as far as I see in the linked documentation to send token and access a private file.
Solution is to have a server you own, download from source and upload it to Cloudflare using their file upload API which reads from local directory.
So the answer is no, you can not directly download from a private server and upload to cloudflare. :/

Login Github with Curl

I tried call this command
curl -l -u "my_user_name" https://my-enterprise-github.com
Then, I input my password manually.
But it returns this
<html><body>You are being redirected.</body></html>
Please explain what's wrong with my command.
Thank you.
cURL should not be used for access to GitHub's (or most web) UI without specific reasons. GitHub provides an API to allow accessing data as a well-defined structure.
You mentioned wanting to get-a-single-pull-request. This relies on a URL pattern following GET /repos/:owner/:repo/pulls/:number.
So if you had a GitHub account, facebook, and wanted to look up a specific pull request 15947 in react-native. The full URL would be
https://api.github.com/repos/facebook/react-native/pulls/15947
The cURL command would be
curl -u osowskit -X GET https://api.github.com/repos/facebook/react-native/pulls/15947
Note that:
You will likely want to start using a PAT or OAuth token instead of username/password
There are tools that make exploring the GitHub API easier. postman or octokit
To start with you may want the -L flag. From the cURL Frequently Asked Questions
3.8 How do I tell curl to follow HTTP redirects?
Curl does not follow so-called redirects by default. The Location: header that informs the client about this is only interpreted if you're using the -L/--location option. As in:
curl -L http://redirector.com
Not all redirects are HTTP ones, see 4.14
There's also a CLI now that can be helpful for many similar use-cases:
https://cli.github.com/
$ gh pr list
Showing 2 of 2 open pull requests in Roblox/service-comms-nomad
#16 chi1 Traefik 1.7 GLB jobs chi1-glb-prep
#6 Cgt/t2 cgt/t2

Response time when sending post to Http GCM server is very high

I am developing an application server to send GCM messages. My application server is sending post requests to GCM connection servers with HTTP protocol. The average response time of a request is acceptable (around 100 milliseconds), but sometimes I'm getting responses with times greater than 1 second. More occasionally I've got some response times of 2, 4 seconds or even more.
I'm using this library gcm-server to send my requests to GCM servers. I believe it's owned by Google.
In order to despite the problem, I've made some analysis in the gcm-server library code but can't found any clue or answer. Ultimately, I decide to send some curl's with valid posts to GCM server. The results are the same. I'm sure this is not the expected behavior, maybe I'm doing something wrong, but can't find or understand what it is.
Below is the script I'm running to test this. I'm sending 1000 post requests to GCM, without any definition of Keep-Alive (by default cURL uses Keep-Alive enabled).
#!/bin/bash
for i in {1..1000}; do
curl -s -w "%{http_code} - %{time_total}\n" -o /dev/null -X POST -H "Content-Type: application/json" -H "Authorization: key={putHereOneGCMValidToken}}" -H "Cache-Control: no-cache" -d '{
"collapse_key": "92667ba1-c8e9-4018-bf14-156417065641",
"delay_while_idle": false,
"data": {
"field1": "value1",
"field2": "value2"
},
"time_to_live": 0,
"registration_ids": [
"REGISTRATION_ID_1",
"REGISTRATION_ID_2",
"BAD_REGISTRATION_ID"
]
}' "https://gcm-http.googleapis.com/gcm/send";
sleep 0.2;
done
Reference:
GCM http server documentation
You are queuing your server with too many Downstream Messaging. Try sending with a lower test numbers. If you are testing or sending to multiple devices or users try Device Group Messaging or Send Messages to Topics.
Device Group Messaging
With device group messaging, app servers can send a single message to multiple instances of an app running on devices belonging to a group.
Send Messages to Topics
GCM topic messaging allows your app server to send a message to multiple devices that have opted in to a particular topic.
Also, you must consider external factor like intermittent internet connection for the delay of receiving the message. Lastly you might want to check this related SO question that experience High Server CPU after sending GCM.
Hope this helps!

API Post Data to Middleware

Anyone know how I can test posting data to this url? I was given the link by the IT supervisor and trying to have the data posted to the following link by submitting the following form. He said it would accept anything I send it
Could could do this via curl:
curl -X POST -d "data=anything_i_send_it" http://powersource.braindongle.com/lead-manager/lead/new/omgpost/sessions/
Or using another HTTP tool like Hurl.it
Or using a Chrome extension like Postman or REST Console.
Advanced Rest Client is an easy way to do it. It's a free chrome extension that can form http requests with data.

curl LinkedIn API

I obtained the oauth token and oauth token secret for the LinkedIn API via Python. I'd like to make some REST calls via curl now and I tried the following ;
curl -v "http://api.linkedin.com/v1/people/~" -d "oauth_token=xxxxxxxxxx" -d "oauth_token_secret=xxxxxxxxxxxxx"
I've used the LinkedIn API in Python but wanted to use in curl. Am I missing something here ?
Any suggestions in this regard will be highly appreciated.
Thank you for your help.
You need to sign the requests using OAuth - usually the best way to do this is to use a library (like you mentioned, the python library works well). You can scoop the HTTP traffic to see what additional headers are being sent. The developer portal at http://developer.linkedin.com has an overview of the OAuth stuff, but it'd be pretty tough to get a working implementation for Curl because each signature you generate will be different (based on timestamp).