Posts a file to Binary Storage
client.CloudforceOne.BinaryStorage.New(ctx, params) (*BinaryStorageNewResponse, error)
POST/accounts/{account_id}/cloudforce-one/binary
Posts a file to Binary Storage
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Accepted Permissions (at least one required)
Posts a file to Binary Storage
package main
import (
"bytes"
"context"
"fmt"
"io"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/cloudforce_one"
"github.com/cloudflare/cloudflare-go/option"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
binaryStorage, err := client.CloudforceOne.BinaryStorage.New(context.TODO(), cloudforce_one.BinaryStorageNewParams{
AccountID: cloudflare.F("account_id"),
File: cloudflare.F(io.Reader(bytes.NewBuffer([]byte("Example data")))),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", binaryStorage.ContentType)
}
{
"content_type": "text/plain",
"md5": "5d84ade76d2a8387c81175bb0cbe6492",
"sha1": "9aff6879626d957eafadda044e4f879aae1e7278",
"sha256": "0000a7f2692ef479e2e3d02661568882cadec451cc8a64d4e7faca29810cd626"
}Returns Examples
{
"content_type": "text/plain",
"md5": "5d84ade76d2a8387c81175bb0cbe6492",
"sha1": "9aff6879626d957eafadda044e4f879aae1e7278",
"sha256": "0000a7f2692ef479e2e3d02661568882cadec451cc8a64d4e7faca29810cd626"
}