How to upload file with editMessageMedia via telegram bot? - json

Editing message text with
curl "https://api.telegram.org/bot123/editMessageText?chat_id=-123123&message_id=123123123&text"=BLAH""
is working
Now I want to edit another message with attached file (replace file )
curl -d media='{"type": "document", "media": "#/home/user/file.mp3"}' "https://api.telegram.org/bot123/editMessageMedia?
chat_id=-123123&message_id=123123124
And get error {"ok":false,"error_code":400,"description":"Bad Request: invalid file HTTP URL specified: URL host is empty"}
How to proprely attach local file here
?

Related

How to login to McMaster-Carr API

I am a beginner trying to log in to McMaster-Carr API. I have a .pfx authentication file, an API password, and my main login/password (email/account password). I have imported the .json file into postman and have inputted my main login credentials in the fields below, but I am not getting a success output message. I am confused as to where the API key/password goes and where I upload the .pfx file as well.
McMaster-Carr API: https://www.mcmaster.com/help/api/
How to upload .pfx file to Postman application
[ Windows / Linux ] - Select File > Settings > Certificates
[ Mac ] - Select Postman > Preferences > Certificates
On the Client Certificates section, select the Add Certificate link
Add the hostname domain of the API service: api.mcmaster.com
Upload the .pfx file
Add the passphrase for the .pfx file: API password
Select Add (details should appear as below)
Close the screen and try to log in again with the same request

Uploading a file to storage location(bucket)

I tried uploading the file using postman ,curl command in windows and linux mentioned in the url https://forge.autodesk.com/en/docs/data/v2/tutorials/upload-file/ but getting gateway timeout error.
I followed the steps in the url https://forge.autodesk.com/en/docs/data/v2/tutorials/upload-file/. I am able to create bucket. But when I tried uploading file to the created bucket its giving 504 gateway timeout error.
Can you give me the solution to resolve this?
Screenshot attached for error
Please find request below:
curl -v 'https://developer.api.autodesk.com/oss/v2/buckets/testbucket/objects/test.3ds' -X 'PUT' -H 'Authorization: Bearer TOKEN' -H 'Content-Type: application/octet-stream' -H 'Content-Length: 308331' -T 'test.3ds'
It looks like the size of your model file is too big to upload, please use the resumable upload API instead, see the related thread here Upload large files (2GB) to Autodesk Forge Data Management API

gdrive command line oauth2: cannot fetch token: 400 Bad Request

Suddenly, gdrive command line tool stops working, and always gives the following error message:
Failed to get about: Get https://www.googleapis.com/drive/v3/about?alt=json&fields=maxImportSizes%2CmaxUploadSize%2CstorageQuota%2Cuser: oauth2: cannot fetch token: 400 Bad Request
Response: {
"error": "invalid_grant",
"error_description": "Bad Request"
}
This is because your authorization token has expired.
Currently there is an open Issue to improve this error message here.
You should delete your token with rm ~/.gdrive/token_v*.json
then run the gdrive about command to reauthorize
The steps I fixed it:
rm ~/.gdrive/token_v2.json as other answer suggested.
But I get danger error if I open the link get from gdrive about to re-authorize:
So I create a drive project by go to https://developers.google.com/drive/api/v3/quickstart/js and click "Enable the Drive API":
Click the "API Console" link on that dialog:
To make default redirect url (i.e. urn:ietf:wg:oauth:2.0:oob) works, we need Installed type app and can't use "Web application type app"(which only allow http/https scheme). So click "Create credentials" and choose "Oauth client ID" item:
Ensure select "Other" type:
Copy "Client ID" and "Client secret" from created item. cd to ~/.go/src/github.com/prasmussen/gdrive/, then replace both at this two variables in handlers_drive.go file, save it, e.g.:
const ClientId = "xxx.apps.googleusercontent.com"
const ClientSecret = "xxx"
Then run go install at that directory. Now run gdrive about and open that link in web browser. I get This app isn't verified error page. You are the author who created that app on above steps and suppose safe. Nevertheless simply click "Advanced" link and click Go to Quickstart (unsafe) link:
Click "Allow" it, copy/paste the code back to gdrive about and done:
Managed to resolve this by retriggering gcloud authorization with:
gcloud auth application-default login

Get activecollab api token from "trial" account, connect with postman

I'm trying to connect to ActiveCollab API trial account with Postman.
I'm stuck at the beginning, because I can't get the required token.
I tried unsuccessfully (got an error) to run the below command in CMD and Powershell:
curl -XPOST -d 'email=mymail#gmail.com&password=myPassword' https://activecollab.com/api/v1/external/login
Error:
curl: no URL specified!
curl: try 'curl --help' for more information
'password' is not recognized as an internal or external command,
operable program or batch file.
then I tried to make the call with postman GET and POST method
url: https://activecollab.com/api/v1/external/login?email=mymail#gmail.com&password=myPassword
with and without parameters, with basic authentication, no authentication and APIkey authentication.....
Also tryed with https://app.activecollab.com/205491/issue-token
with body type json:
{
"username": "mymail#gmail.com",
"password": "maypassword",
}
and with username and password in headers, with no success
Can anybody make or describe how to make a postman call to get the token and an simple example how to get/add project.
Does anybody know if this documentation is up to date?
It's described at this page:
https://developers.activecollab.com/api-documentation/v1/authentication.html
Your correct endpoint would be: https://app.activecollab.com/205491/api/v1/issue-token

How I can save a page to Wayback Machine?

I checked their API documentation and didn't find anything useful that gives me the ability to create snapshots of the URLs I choose.
Submitting a POST request to the root path (https://pragma.archivelab.org) with JSON data containing url (String) and annotation (Object) fields will save a snapshot of url using the Wayback Machine and store the annotation object, making a bidirectional link between the stored snapshot and annotation entries.
Here's an example of such a request:
curl -X POST -H "Content-Type: application/json" -d '{"url": "google.com", "annotation": {"id": "lst-ib", "message": "Theres a microphone button in the searchbox"}}' https://pragma.archivelab.org