Skip to content

JSON in body of request #132

@aarontwf

Description

@aarontwf

Hey, just wondering how JSON is supposed to be sent?
Tried a few things but getting different errors back.

This is the API request I'm trying https://docs.github.com/en/rest/reference/issues#create-a-label

    steps:
      - uses: octokit/request-action@v2.x
        with:
          route: POST /repos/${{ github.repository }}/labels
          body: "'\\'{\"name\":\"React ${{ github.event.ref }}\"}\\''"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Error: end of the stream or a document separator is expected (1:4)

 1 | '\'{"name":"React aarontwf-patch-2"}\''
--------^

body: "''{\"name\":\"React ${{ github.event.ref }}\"}''"
Error: end of the stream or a document separator is expected (1:3)

 1 | ''{"name":"React aarontwf-patch-1"}''
-------^

body: "'{\"name\":\"React ${{ github.event.ref }}\"}'"
Error: Invalid request.

"name" wasn't supplied.

body: '{"name":"React ${{ github.event.ref }}"}'
Error: Invalid request.

"name" wasn't supplied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DocumentationImprovements or additions to documentationType: SupportAny questions, information, or general needs around the SDK or GitHub APIs

    Type

    No type

    Projects

    Status

    🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions