I am trying to convert this example script (from Rumble's Upload API) to using CURL:
curl -F "access_token=XXXXX" \ -F "title=A cool video" \ -F "description=Some detailed description" \ -F "license_type=0" \ -F "channel_id=123" \ -F "video=#video.mp4" \ -F "thumb=#thumbnail.jpg" \ "https://rumble.com/api/simple-upload.php"
I've been trying to get the following code working to upload videos via API to our Rumble account. I'm new to Curl and CFEXECUTE but not new to Coldfusion:
<cfexecute name = "/usr/bin/curl" arguments = "-X POST --insecure https://rumble.com/api/simple-upload.php -F access_token=#access# -F title=#titletouse# - F description=#descript# -F license_type=0 -F channel_id=#channel# -F video=##form.video#" variable="response" timeout = "999"> </cfexecute>
Most of the time the response is: [empty string]
The variables listed are required. I'm pretty sure it IS connecting to Rumble because I tried bunch of different versions and one was without POST and got back JSON response data and another was without an -F before description and got back: { "success": false, "errors": { "description": { "code": "MISSING_OR_INVALID_VALUE" } } }
For example, I tried:
with single quotes around each form field '-F license_type=0'
with -H 'Content-Type:multipart/form-data'
with semi colons between fields: -F licensetype=0;-F channel_id=#channel#
Any suggestions on what I'm doing wrong? I have tried about 30 different things.... and am out of ideas. Thank you!!!!!
Transfer.sh is a service that you can upload files by curl. I'm getting this error when I try to upload some file:
$ curl --upload-file file -s -w "\n" https://transfer.sh/
Could not save metadata
The service seems to be unstable.
You can use https://file.io
$ curl -F "file=#file" -s -w "\n" https://file.io {"success":true,"key":"Y7PDKv","link":"https://file.io/Y7PDKv","expiry":"14 days"}
With this bash function you can obtain the link
snd() {
curl --progress-bar -F "file=#$1" -s -w "\n" https://file.io | jq -r '.link'
}
alias snd=snd
How To use: snd filename.ext
Obtain: https://file.io/0uw5yYbkguc4
To parse the upload response, json, need to install "jq"
Is there any way to issue a presigned URL to a client to upload a file to S3, and ensure that the uploaded file has certain tags? Using the Python SDK here as an example, this generates a URL as desired:
s3.generate_presigned_url('put_object',
ExpiresIn=3600,
Params=dict(Bucket='foo',
Key='bar',
ContentType='text/plain',
Tagging='foo=bar'))
This is satisfactory when uploading while explicitly providing tags:
$ curl 'https://foo.s3.amazonaws.com/bar?AWSAccessKeyId=...&Signature=...&content-type=text%2Fplain&x-amz-tagging=foo%3Dbar&Expires=1538404508' \
-X PUT
-H 'Content-Type: text/plain' \
-H 'x-amz-tagging: foo=bar' \
--data-binary foobar
However, S3 also accepts the request when omitting -H 'x-amz-tagging: foo=bar', which uploads the object without tags. Since I don't have control over the client, that's… bad.
I've tried creating an empty object first and tagging it, then issuing the presigned URL to it, but PUTting the object replaces it entirely, including removing any tags.
I've tried issuing a presigned POST URL, but that doesn't seem to support the tagging parameter at all:
s3.generate_presigned_post('foo', 'bar', {'tagging': '<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>'})
$ curl https://foo.s3.amazonaws.com/ \
-F key=bar \
-F 'tagging=<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>'
-F AWSAccessKeyId=... \
-F policy=... \
-F signature=... \
-F file=#/tmp/foo
<Error><Code>AccessDenied</Code><Message>Invalid according to Policy:
Extra input fields: tagging</Message>...
I simply want to let a client upload a file directly to S3, and ensure that it's tagged a certain way in the process. Any way to do that?
Try the following code:
fields = {
"x-amz-meta-u1": "value1",
"x-amz-meta-u2": "value2"
}
conditions = [
{"x-amz-meta-u1": "value1"},
{"x-amz-meta-u2": "value2"}
]
presignedurl = s3_client.generate_presigned_post(
bucket_name, "YOUR_BUCKET_NAME",
Fields=copy.deepcopy(fields),
Conditions=copy.deepcopy(conditions)
)
Python code:
fields = {
'tagging': '<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>',
}
conditions = [
{'tagging': '<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>'}
]
presigned_url = s3_client.generate_presigned_post(
Bucket="foo",
Key="file/key.json",
Fields=copy.deepcopy(fields),
Conditions=copy.deepcopy(conditions)
)
CURL command:
$ curl -v --form-string "tagging=<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>" \
-F key=file/key.json \
-F x-amz-algorithm=... \
-F x-amz-credential=... \
-F x-amz-date=... \
-F x-amz-security-token=... \
-F policy=...\
-F x-amz-signature=... \
-F file=#key.json \
https://foo.s3.amazonaws.com/
Explanation
It is imperative that --form-string is used in the CURL command, otherwise CURL will interpret the =< as reading in a file!
Also ensure that key.json is in your current working directory for CURL to upload the file to S3 using the pre-signed-url.
I'm currently developing a VB.NET program in Visual Studio 2017, and while I'm reasonably competent with most aspects of VB.NET, this one has me completely stumped.
The program needs to POST multipart/form data to Mixcloud (which is like Soundcloud but for radio programmes). After some research, all I have found are dead ends. In Mixcloud's API for uploading (found here), they give a CURL example on how to do it. Would anyone have an idea on how to implement this in VB.NET? Many thanks in advance for any help available.
Here is their example:
curl -F mp3=#upload.mp3 \
-F "name=API Upload" \
-F "tags-0-tag=Test" \
-F "tags-1-tag=API" \
-F "sections-0-chapter=Introduction" \
-F "sections-0-start_time=0" \
-F "sections-1-artist=Artist Name" \
-F "sections-1-song=Song Title" \
-F "sections-1-start_time=10" \
-F "description=My test upload" \
https://api.mixcloud.com//upload/?access_token=INSERT_ACCESS_TOKEN_HERE
(The "sections" are essentially markers that are shown on the player to highlight different points of a radio show - just to provide some context!)
Following the instagram API documentation, I ran the following in the command line:
$ curl -F 'client_id=my_client_id' \
> -F 'client_secret=my_client_secret' \
> -F 'object-geography' \
> -F 'aspect=media' \
> -F 'lat=35.657872' \
> -F 'lng=139.70232' \
> -F 'radius=1000' \
> -F 'callback_url=http://http://requestb.in/my_string' \
> https://api.instagram.com/v1/subscriptions/
and got the following error:
Warning: Illegally formatted input field!
curl: option -F: is badly used here
curl: try 'curl --help' or 'curl --manual' for more information
I did try curl --help and curl --manual, but wasn't able to figure this out based on their contents. How might I successfully create a subscription?
You are facing problem with this one:
> -F 'object-geography' \
It supposed to be Key=Value paired parameter. But you are using only one. So check this out. Probably it will be
> -F 'object=geography' \
^ check this