It has been moved into kubo's repo at github.com/ipfs/kubo/client/rpc
.
This allows that any updates or change to kubo's coreapi is immediately reflected on the client too.
MIT
[archived] Legacy Kubo RPC client, use kubo/client/rpc instead.
License: MIT License
It has been moved into kubo's repo at github.com/ipfs/kubo/client/rpc
.
This allows that any updates or change to kubo's coreapi is immediately reflected on the client too.
MIT
Since RequestBuilder
has no public constructor or access to modify shell *HttpApi
, there isn't a way to use this package to send a request outside of what's defined in iface.CoreAPI
.
Specifically, I'd like to request for the daemon's peer ID over the API, which I had access to in go-ipfs-api
:
https://github.com/ipfs/go-ipfs-api/blob/master/shell.go#L112-L116
We can, with little difficulty, throw in a client-side cache over the Dag API. The one drawback is that a GC might be run while we're caching some unpinned object.
After upgrading to go-ipfs-http-client v0.6.0 I recieve the following errors when attemping to run my program
# github.com/ipfs/go-ipfs-http-client
../../go/pkg/mod/github.com/ipfs/[email protected]/api.go:214:9: cannot use (*RoutingAPI)(api) (value of type *RoutingAPI) as iface.RoutingAPI value in return statement: *RoutingAPI does not implement iface.RoutingAPI (wrong type for method Put)
have Put(context.Context, string, []byte) error
want Put(context.Context, string, []byte, ...options.RoutingPutOption) error
../../go/pkg/mod/github.com/ipfs/[email protected]/dag.go:37:16: undefined: format.DefaultBlockDecoder
../../go/pkg/mod/github.com/ipfs/[email protected]/pin.go:204:16: cannot use &pinVerifyRes{…} (value of type *pinVerifyRes) as iface.PinStatus value in send: *pinVerifyRes does not implement iface.PinStatus (missing method Err)
Hi Team,
Is it possible to add a base64 encoded input into IPFS using go-ipfs http client and while fetching the file using CID can we download the physical file instead of the base64 input that we have stored in IPFS for that file?
Currently (#1), api.ResolvePath
uses dag/resolve
for path resolving, which isn't ideal. We should be able to just use resolve
once ipfs/kubo#5703 is fixed
[email protected] will cause the following test result Fail:
--- FAIL: TestHttpApi/Dht (20.06s)
--- PASS: TestHttpApi/Dht/TestDhtFindPeer (11.34s)
--- FAIL: TestHttpApi/Dht/TestDhtFindProviders (4.46s)
dht.go:109: got wrong provider: != QmRGNoLuVF432xDgJY39Mz2L9e43ZNB6EJ6MAvbbPqTysV
--- FAIL: TestHttpApi/Dht/TestDhtProvide (4.26s)
dht.go:164: got wrong provider: != QmY23hJii91v3dqgBPZE1ALWq4FqQU4aQbMPsCNXA6zapp
can .travis.yml
be updated to a newer version?
I tested release version 0.6.0 and 0.5.0, the project passed the test
$ go test -test.v -test.run ^TestHttpApi$
=== RUN TestHttpApi
=== RUN TestHttpApi/Block
=== RUN TestHttpApi/Block/TestBlockPut
=== RUN TestHttpApi/Block/TestBlockPutFormat
=== RUN TestHttpApi/Block/TestBlockPutHash
=== RUN TestHttpApi/Block/TestBlockGet
=== RUN TestHttpApi/Block/TestBlockRm
=== RUN TestHttpApi/Block/TestBlockStat
=== RUN TestHttpApi/Block/TestBlockPin
=== RUN TestHttpApi/Dag
=== RUN TestHttpApi/Dag/TestPut
=== RUN TestHttpApi/Dag/TestPutWithHash
=== RUN TestHttpApi/Dag/TestPath
=== RUN TestHttpApi/Dag/TestTree
=== RUN TestHttpApi/Dag/TestBatch
=== RUN TestHttpApi/Dht
=== RUN TestHttpApi/Dht/TestDhtFindPeer
=== RUN TestHttpApi/Dht/TestDhtFindProviders
=== RUN TestHttpApi/Dht/TestDhtProvide
=== RUN TestHttpApi/TestsCancelCtx
--- PASS: TestHttpApi (18.56s)
--- PASS: TestHttpApi/Block (3.41s)
--- PASS: TestHttpApi/Block/TestBlockPut (0.08s)
--- PASS: TestHttpApi/Block/TestBlockPutFormat (0.07s)
--- PASS: TestHttpApi/Block/TestBlockPutHash (0.10s)
--- PASS: TestHttpApi/Block/TestBlockGet (0.10s)
--- PASS: TestHttpApi/Block/TestBlockRm (0.13s)
--- PASS: TestHttpApi/Block/TestBlockStat (0.07s)
--- PASS: TestHttpApi/Block/TestBlockPin (0.27s)
--- PASS: TestHttpApi/Dag (0.60s)
--- PASS: TestHttpApi/Dag/TestPut (0.11s)
--- PASS: TestHttpApi/Dag/TestPutWithHash (0.09s)
--- PASS: TestHttpApi/Dag/TestPath (0.17s)
--- PASS: TestHttpApi/Dag/TestTree (0.12s)
--- PASS: TestHttpApi/Dag/TestBatch (0.12s)
--- PASS: TestHttpApi/Dht (14.54s)
--- PASS: TestHttpApi/Dht/TestDhtFindPeer (5.21s)
--- PASS: TestHttpApi/Dht/TestDhtFindProviders (4.64s)
--- PASS: TestHttpApi/Dht/TestDhtProvide (4.69s)
--- PASS: TestHttpApi/TestsCancelCtx (0.00s)
PASS
ok github.com/ipfs/go-ipfs-http-client 18.589s
$ ipfs version
ipfs version 0.5.0
I am writing a Go script to add real-time HLS live video segments to a remote IPFS machine, while I am using this client, I cannot find the file operation commands like ipfs files cp
, ipfs files rm
, ipfs files mkdir
and ipfs files ls
.
So far I can only use api.Unixfs().Add()
, but the the pinned file names show in CIDs which carry no time information, I cannot unpin the files that created before certain time point.
Is there any way to invoke those commands?
Thanks,
Once go-ipfs 0.5.0 has been released.
Hi, there is currently no example of how to connect this client to an ipfs node within the README here or within the godocs. Is it possible this can be added? Something similar to what is provided for go-ipfs-api.
package main
import (
"fmt"
"strings"
"os"
shell "github.com/ipfs/go-ipfs-api"
)
func main() {
// Where your local node is running on localhost:5001
sh := shell.NewShell("localhost:5001")
cid, err := sh.Add(strings.NewReader("hello world!"))
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s", err)
os.Exit(1)
}
fmt.Printf("added %s", cid)
}
That would be very helpful for new users to this library. For context, I am doing some testing against remote Infura IPFS nodes to ensure the supported methods function as expected.
Thanks!
When using NewApiWithClient
and providing a multiaddress, it results in a HTTP request, even if the multiaddress specifies HTTPS.
For example,
api, _ := NewApiWithClient(ma.NewMultiaddr("/dns4/example.com/tcp/443/https"), &http.Client{})
api.url == "example.com:80"
# in request.go we find
if !strings.HasPrefix(url, "http") {
url = "http://" + url
}
NewApiWithClient
should return a HttpApi
whose url contains the url protocol (http or https).
It's duplicated in go-ipfs-api, if it can be extracted it would make maintaining both libraries at the same time easier
If the default ~/.ipfs
, IPFS_PATH
env var, or ipfspath
function arg passed to NewPathApi
is a non-existent directory, it will return nil
error and nil
client.
A common pattern in golang is this:
cln, err := httpapi.NewLocalApi()
if err != nil {
return err
}
// cln.Unixfs().Add ...
But that becomes a nil pointer reference. Curious why os.IsNotExist
errors are hidden here:
https://github.com/ipfs/go-ipfs-http-client/blob/master/api.go#L56-L59
I am sorry to be bothered many times.
now i has two questions:
in this package /api/v0/add
was not found. will add this interface later?
(api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption)
has no arg
parameter to input.
i see the https://docs.ipfs.io/reference/api/http/#api-v0-pin-ls
has it.
and i neet it now. will add this parameter in this interface ?
Currently, this directly invokes the ls
HTTP API endpoint but that means we need to duplicate some logic. It would be nice if we could just call Unixfs().Ls()
and use that.
The equivalent of https://docs.ipfs.io/reference/api/cli/#ipfs-files-stat, returns stuff like:
{
"Hash":"QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ",
"Size":0,
"CumulativeSize":443417,
"Blocks":1,
"Type":"directory"
}
and
{
"Hash":"Qmd286K6pohQcTKYqnS1YhWrCiS4gz7Xi34sdwMe9USZ7u",
"Size":443230,
"CumulativeSize":443362,
"Blocks":2,
"Type":"file"
}
the api
file can only used in the same machine.
if you are running in the docker.
you cant visit the api
file out of the container.
so we need create the api with a string address as you know.
i add a pull request to added a create function
ps: i found a path join miss in windows. so i fixed it.
pull path:
To call ipfs pin ls SOME_PIN
.
if used this project with the latest ipfs/[email protected]
your source will build failed
i fixed it in a fork.
at the same time it also fixed issue #26
if you want i can pr the source
I am using infura go-ipfs-http-client to get data for given path. I get data, but when unmarshalling json to Struct it fails with below error
panic: invalid character '\b' looking for beginning of value
Code:
//content := strings.NewReader("Infura IPFS - Getting started demo.")
mypath := path.New("Qmb5zeyvU7ZpotLDzkUmSeMDA71MExp8eJyNeefGdoeA2x/2")
reader, err := httpApi.Object().Data(context.Background(), mypath)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
var nftData NFTTraitData
data, _ := ioutil.ReadAll(reader)
err1 := json.Unmarshal([]byte(data), &nftData)
if err1 != nil {
panic(err1)
}
Response received in "data" field
☻↕�♣{"name":"Obit #2","description":"AN 8-BIT OBITUARY OF FAMILY FIENDS\n\nThere are 7,132 Obits. We are all unique, restless souls of our own generation. Dead Ringers are the most coveted of the clan but ownership of any Obit will grant you access to exclusive launches, airdrops, and other surprising pleasures. Grave pleasures indeed.\n\nVisit the [Obits website](https://obitsnft.com) for more details.","background_color":"cccccc","image":"ipfs://QmPASmu4tqbgwuceqWtHbEZTrn24zsva1NDBxpfzEjVpQR/2.png","external_url":"https://obitsnft.com","attributes":[{"trait_type":"type","value":"Female"},{"trait_type":"Accessory","value":"Black Side"},{"trait_type":"Accessory","value":"Cigar"},{"trait_type":"Lived","value":"1999 - 2018"}]}↑�♣
Do we need to perform some decoding etc?
Thanks, that would help to get rid of libipfs messing things up :-)
Hello all,
I am struggling to get a "write" working on the mfs via the ipfs-http-api,
however a web-form or a curl curl -F [email protected] "http://localhost:5001/api/v0/files/write?arg=/tmp/myfile&create=true"
works fine.
I am using LWP::UserAgent from a perl script;
here is the code I am running (note the post request works for a "ipfs add").
#!/usr/bin/perl
use LWP::UserAgent;
my $filepath='/tmp/data.txt';
my $filename="/my/files/data.txt";
my $data="hello, World!";
my $url="http://127.0.0.1:5001/api/v0/files/write?arg=$filename&create=1&parents=1";
my $ua = LWP::UserAgent->new();
my $form = [
'file' => ["$filepath" => "$filename", Content => "$data" ]
# 'file' => ["$filepath" => "$filename" ]
];
my $resp = $ua->post($url,$form, 'Content-Type' => 'multipart/form-data;boundary=-----a-special-boundary-543-67');
printf "X-Status: %s\n",$resp->status_line;
if ($resp->is_success) {
my $content = $resp->decoded_content;
# ...
}
printf "X-content: %s\n",$resp->decoded_content;
what is odd it that the LWP::UAgent call work for an ipfs add, but not for an ipfs files write ?
the error message I have is : {"Message":"file argument was nil","Code":0,"Type":"error"}
my complete script is : write_api.pl.txt
please advise,
thank you
Projects that depend on ipfs/[email protected] cannot use ipfs/[email protected]. If we try, we get errors like:
go build .
# github.com/libp2p/go-libp2p-core/network
../../../go/pkg/mod/github.com/libp2p/[email protected]/network/rcmgr.go:166:27: network.NullResourceManager (type) is not an expression
go mod why github.com/libp2p/go-libp2p-core/network
# github.com/libp2p/go-libp2p-core/network
github.com/ipfs/go-ipfs-http-client
github.com/libp2p/go-libp2p-core/network
ipfs/go-ipfs-http-client depends on:
Line 12 in 171fcd5
Which depends on:
Line 15 in 171fcd5
But is archived and contains deprecated methods like:
I wanted to surface an issue to the community to get it's corresponding guidance. Let me know what you think? 🙏
For example, log/tail
. These are useful APIs but we may not want to stabilize them. Thoughts? We do expose Request
so we could, alternatively, provide some kind of "unstable" wrapper:
type UnstableAPI struct {
*HttpApi
}
... unstable stuff
Or we could just document these interfaces as "unstable".
rename this to something better than doesnt assume http.
Placeholder issue so we don't forget, part of ipfs/kubo#9124
cid.CodecToStr
was removed in go-cid v0.2.0 (ipfs/go-cid#137), but go-ipfs-http-client still depends on cid.CodecToStr
: https://github.com/ipfs/go-ipfs-http-client/blob/v0.3.1/dag.go#L59
Hi team,
I have setup a private IPFS cluster based network for decentralized files storage, and I'm using IPFS-Cluster-http client for adding files into the network. I have a setup of 3 cluster nodes and correspondingly 1 IPFS node against each of the Cluster node.
Now while adding multiple files using the /add API I'm getting the output of the stream data with multiple CIDs, but while I'm searching for those CIDs in my cluster node using:
ipfs-cluster-ctl pin ls | grep "[CID]"
I'm not able to fetch the details corresponding to passed CID, but while fetching the file using get API call by passing the given CID
I'm able to retrieve the file.
And, while I'm trying to pin the CID manually by using:
ipfs-cluster-ctl pin add [CID]
then I'm getting this error:
/data/ipfs/datastore/368613.log: no space left on device
Can someone please help me with the issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.