> For the complete documentation index, see [llms.txt](https://memolabs.gitbook.io/memo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://memolabs.gitbook.io/memo/start-usage/http-operation.md).

# HTTP Operation

Mefs commands can all be operated using HTTP.

Configuration

Before mefs-user starts, confirm the following configuration is set in the config.json:

```shell
// mefs api port setting, default is 5001

api.address is set to: /ip4/0.0.0.0/tcp/5001

// cross-domain access

api.accessControlAllowOrigin is set to: ["*"]

api.accessControlAllowMethods is set to: ["PUT","GET", "POST"]
```

Then restart mefs-user to use HTTP to operate.

**Usage**

A command similar to the following:

```shell
mefs-user rootcmd subcmd <arg1> <arg2> -opname1=<op1> -opname2=<op2>
```

The corresponding HTTP request is:

```shell
curl "http://<ip>:<port>/api/v0/<rootcmd>/<subcmd>?arg=<arg1>&arg=<arg2>&opname1=<op1>&opname2=<op2>"
```

IP is the network address of the machine where mefs-user is started. The port defaults to 5001. If cross-domain access is configured before running, you can use the external network IP to access, otherwise you can only access it through 127.0.0.1.

### [Example](https://docs.memolabs.org/#/start-and-usage/http-operation?id=example) <a href="#example" id="example"></a>

#### [Show all bucket information](https://docs.memolabs.org/#/start-and-usage/http-operation?id=show-all-bucket-information) <a href="#show-all-bucket-information" id="show-all-bucket-information"></a>

```shell
curl "http://127.0.0.1:5001/api/v0/lfs/list_buckets?addr=<public key>"
```

The output is in standard JSON format:

```json
  {
    "Method": "List Buckets",
    "Buckets": [
      {
        "BucketName": "<BucketName>",
        "BucketID": "<BucketID>",
        "Ctime": "<Ctime>",
        "Policy": "<Policy>",
        "DataCount": "<DataCount>",
        "ParityCount": "<ParityCount>"
      },
      {
        "BucketName": "<BucketName>",
        "BucketID": "<BucketID>",
        "Ctime": "<Ctime>",
        "Policy": "<Policy>",
        "DataCount": "<DataCount>",
        "ParityCount": "<ParityCount>"
      }
    ]
  }
```

#### [Display Information about All Objects in a Bucket](https://docs.memolabs.org/#/start-and-usage/http-operation?id=display-information-about-all-objects-in-a-bucket) <a href="#display-information-about-all-objects-in-a-bucket" id="display-information-about-all-objects-in-a-bucket"></a>

```shell
curl "http://127.0.0.1:5001/api/v0/lfs/list_objects?arg=<BucketName>&addr=<public key>"
```

The output is in standard JSON format:

```json
{
  "Method": "List Objects",
  "Objects": [
    {
      "ObjectName": "<ObjectName>",
      "ObjectSize": "<ObjectSize>",
      "Ctime": "<Ctime>",
      "Dir": "<Dir>",
      "LatestChalTime": "<LatestChalTime>"
    },
    {
      "ObjectName": "<ObjectName>",
      "ObjectSize": "<ObjectSize>",
      "Ctime": "<Ctime>",
      "Dir": "<Dir>",
      "LatestChalTime": "<LatestChalTime>"
    }
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://memolabs.gitbook.io/memo/start-usage/http-operation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
