Noob Question: Can I uploads file via API?

Hello.

This was my first time using Object Storage. I want to ask, is it possible for me to upload via API URL? like upload via PHP but the file will be stored in Storj.

For example :
API URL : https://api.storj.io/upload/to/myBucket?api_key=MY_API_KEY
then I send the file/image through that URL API. (PUT)

1 Like

Welcome to the forum @arachi004 !

There is a php implementation :point_down:

2 Likes

Hello @arachi004,
Welcome to the forum!

It’s also possible to do it not only with uplink binding, but using a presigned URLs or with AWS SDK. But please note - in this case you will use a server-side encryption, unlike with a native integration and client-side encryption.

3 Likes

Hi @Alexey

Hope you’re well!

I want to be able to upload (using Node & Python) an object/file WITHOUT having to use a SINGLE cli command. The user will be on a client app which can be ANYONE of:
a. An extension in a desktop browser
b. A React Native mobile app
c. A middleware instance (running in Python).
I need to do this in code, cannot use any terminal/cli command.

What I read/checkout?
Including the pre-signed URLs and the AWS SDK links you shared above PLUS everything else in the developer docs

Outcome of reading docs
In all cases, (rclone/aws-cli/uplink), I’d have to invoke a cli terminal command to upload a file.

What do I want to do programmatically?
Create buckets, delete buckets, upload files, download files, etc… all in code. Do you have a pure “API without cli” that connects directly to the gateway for uploads?

Note: I perform client side data encryption.

How can I achieve this?

Thank you.

@Alexey

I found
Python: I found this: GitHub - storj-thirdparty/uplink-python: Python bindings for libuplink
Node: GitHub - storj-thirdparty/uplink-nodejs: NodeJS / typescript bindings for libuplink

They rely on libuplinkc.so (from Storj) so I’m asking if underlying libraries are up to date (have not been updated since mid '21, ~2 years ago now).

Thank you!

You’ll want to use presigned urls with the aws SDK for your client apps to upload directly to Storj via the Storj’s s3 compatible gateway. The aws sdk will allow you do the upload in the language of your choice without using a cli tool

You may find this example helpful Sample NodeJS and React code using presigned urls and AWS SDK V3

2 Likes

Hello @Daemon-Fadi,
Welcome to the forum!

You can try to use these bindings too, they should work. But if you want to use S3 protocol, I believe you have only one choice - to use presigned URLs.

Thanks @danw; Watched your YT recorded live stream online (Feb '23).
:heart:'ed the unfiltered approach to fixing bugs as you were coding.

I understood that the authority responsible for providing the presigned S3 URL is AWS; Not Storj (ie: this is NOT a library Storj provides to generate the pre-signed URL (e.g.: boto3 in Python).

I want to avoid AWS, GCP, Azure, etc… at all costs. Even if I have to setup my own private S3 service (which I’d like to avoid, and hence why I am here to use Storj).

Note: I can use file instead of objects/buckets. As long as I have access to a meaningful organization structure (folders, etc…) without sacrificing the Storj performance.

So what other method is there to store create buckets/objects besides the approach you suggested?

Thanks!

1 Like

Thanks @Alexey .

As I mentioned to @danw, I want to avoid any interaction with AWS (or GCP, Azure, etc… Even if it’s just for signing URLs). We’re a decentralized service. We cannot have a dependency on a centralized server.

We intentionally host & manage a decentralized k8s cluster (with services) and as we gather more users it’ll become even more decentralized. We simply want no dependency on services like AWS…

Thanks!

1 Like

No, you just use the SDK, it’s not connected to AWS, you may use the AWS SDK for any S3-compatible storage provider, include Storj DCS, and it will not connect to AWS, unless you configure it to do so. You provides an Access Key, Secret Key and Endpoint to use Storj DCS instead of AWS. These S3 credentials you may generate in the Storj Console: Generating and Managing Access Grants - Storj Docs or using uplink CLI: share - Storj Docs or access register - Storj Docs

1 Like