Backblaze-B2V4

 view release on metacpan or  search on metacpan

lib/Backblaze/B2V4.pm  view on Meta::CPAN

token and upload URL.  You can retrieve these via b2_get_upload_info()
with the bucket name as an argument.

Example:

	my $results = $b2->b2_get_upload_info(
	  bucket_name => 'MyBucketName'
	);

The %$results hash now has 'upload_url' and 'authorization_token'

Note: You have to call b2_get_upload_info on a bucket for each file
upload operation.  My b2_upload_file method does that for you, so that's
just FYI if you roll your own.

See: https://www.backblaze.com/b2/docs/b2_get_upload_info.html

=head2 send_request

send_request() handles all the communications with B2.
You should be able to use this to make calls not explicitly
provided by this library.

If send_request() gets a 200 HTTP status from B2, then the call went
great, $b2->current_status_is_not_ok will be 0, and 
the JSON response will be returned.

If a 200 is not received from B2, $b2->current_status_is_not_ok
will be 1, and you can find an error in $b2->latest_error()

Note that the base URL for this API session will be stored
under $b2->api_info->{api_url} so that you build a URL like so:

$list_buckets_url = $b2->api_info->{api_url}.'/b2api/v4/b2_list_buckets';

Example of a GET API request:

	my $response = $b2->send_request(
	  url => 'https://SomeB2.API.URL?with=GETparams',
	);

Example of a POST API request:

	my $response = $b2->send_request(
	  url => 'https://SomeB2.API.URL',
	  post_params => {
	    param1_name => 'param1_value',
	    param2_name => 'param2_value',
	    param3_name => 'param3_value',
	  },
	);

See: https://www.backblaze.com/b2/docs/b2_list_buckets.html

=head1 DEPENDENCIES

This module requires:

	Cpanel::JSON::XS
	Digest::SHA
	HTTP::Request
	LWP::Protocol::https
	LWP::UserAgent
	Marlin
	MIME::Base64
	Path::Tiny
	URI::Escape

=head1 SEE ALSO

B2 API V4 Docs: https://www.backblaze.com/apidocs/b2-authorize-account

Paws::S3 - If using Backblaze's S3-compatible API.

=head1 AUTHOR / BUGS

Eric Chernoff <eric@weaverstreet.net> - Please send me a note with any bugs or suggestions.

ESTRABD <estrabd@cpan.org> - Enhanced b2_list_file_names() to fully use options and a great bugfix 
when using the 'file_contents' option in the b2_upload_file() method.

=head1 LICENSE

MIT License

Copyright (c) 2026 Eric Chernoff

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDE...



( run in 1.474 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )