How to add multiline comments to mergerequests in gitlab via rest api?

i looked at the documentation but its hard to understand how it works.

This is my current restcall:

{
    "body": "Via Rest",
    "position": {
        "base_sha": "bcdfbfd57c8f3cd6cd65998464bb71a562d49948",
        "start_sha": "bcdfbfd57c8f3cd6cd65998464bb71a562d49948",
        "head_sha": "5828c8f62744f8c63d2e35cfb17988380a3a63d6",
        "new_path": "README.md",
        "position_type": "text",
        "line_range": {
            "start": {
                "line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_0_6",
                "type": "new"
            },
            "end": {
                "line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_0_11",
                "type": "new"
            }
        }
    }
}

The response is:

"message": "400 Bad request - Note {:line_code=>[\"can't be blank\", \"must be a valid line code\"], :position=>[\"is incomplete\"]}"

But what i dont understand is that line_code is not blank...

I also dont understand how the linecode itself works. I am adding a new comment, so SHA1HASH_OLDLINE_NEWLINE doesnt work as a format, since iam not referencing any old line. I looked at existing muliti line comments, but when i copy them (HASH_12_6 and HASH_12_11), it still returns the same error.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation