ipfs-docs icon indicating copy to clipboard operation
ipfs-docs copied to clipboard

[Question] :Add Delete Pin, through http-api, how?

Open Xyncgas opened this issue 3 years ago • 1 comments

I tried posting something in my dotnet program :

class payload
{
    public string? content;
}
public class Program
{
    public static async Task Main(string[] args)
    {
        HttpClient httpClient = new HttpClient();
        var pl = new payload
        {
            content = "ABC"
        };
        var content = new StringContent(JsonSerializer.Serialize(pl, new JsonSerializerOptions
        {
            IncludeFields = true,
            DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
        }), Encoding.UTF8, "application/json");
        var res = await httpClient.PostAsync("http://localhost:5002/api/v0/add", content);
        Console.WriteLine(await res.Content.ReadAsStringAsync());
    }
}

I am trying to add a file, but I couldn't do it after reading many documentations including http://docs.ipfs.io.ipns.localhost:50002/reference/http/api/#getting-started

While this program logs

file argument 'path' is required

image seems be saying you don't need path https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md

Can someone help me with simple examples how to add, delete, pin. I am not using an existing file, I just want to tell the API to create one in ipfs by providing the content of the file like "Hello World" And get back CID that I can go to https://ipfs.io/ipfs/{CID} and see "Hello World" And Use that CID to delete the file. And use that CID to Pin the file

Xyncgas avatar Dec 05 '21 06:12 Xyncgas

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additiona round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

welcome[bot] avatar Dec 05 '21 06:12 welcome[bot]