curl icon indicating copy to clipboard operation
curl copied to clipboard

How to give json data in the args section?

Open chiju opened this issue 6 years ago • 4 comments

Getting error " mapping values are not allowed in this context" while having workflow as given below < on: push jobs: curl: runs-on: ubuntu-latest steps: - name: curl uses: wei/curl@master with: args: -vvf -uxxxxxxxxxxxxxxxxxxxxx -H "Content-Type: application/json" -X POST https://api.bintray.com/packages/chiju/rpms/openssh/versions --data '{"name": "7.6", "github_use_tag_release_notes": false }'

chiju avatar Sep 26 '19 12:09 chiju

Need.

Same problem Thanks

ftx avatar Nov 09 '19 19:11 ftx

Your problem is in your YAML syntax not this action.

: isn't normally something you need to worry about in YAML but : followed by a space becomes a key separator. You need to escape the space, for example in your script you need to escape the content type but with the data you can just remove the spaces.

args: -vvf -uxxxxxxxxxxxxxxxxxxxxx -H "Content-Type:\ application/json" -X POST https://api.bintray.com/packages/chiju/rpms/openssh/versions --data '{"name":"7.6", "github_use_tag_release_notes":false }'

Try a YAML parser to find issues in future and read this StackOverflow post if you want more info.

johnathan99j avatar Dec 06 '19 10:12 johnathan99j

Your problem is in your YAML syntax not this action.

: isn't normally something you need to worry about in YAML but : followed by a space becomes a key separator. You need to escape the space, for example in your script you need to escape the content type but with the data you can just remove the spaces.

args: -vvf -uxxxxxxxxxxxxxxxxxxxxx -H "Content-Type:\ application/json" -X POST https://api.bintray.com/packages/chiju/rpms/openssh/versions --data '{"name":"7.6", "github_use_tag_release_notes":false }'

Try a YAML parser to find issues in future and read this StackOverflow post if you want more info.

Saved my hours.

LangInteger avatar Jul 25 '20 04:07 LangInteger

Please guys don't hurt yourself during 1 day like me. I want peace.

      - name: Patch Scaleway Serverless container front
        uses: wei/curl@v1
        with:
          args: --location --request PATCH https://api.scaleway.com/containers/v1beta1/regions/fr-par/containers/3ccb12f1-7775-405f-8685-6ecb3021df89 --header \'X-Auth-Token:\ ${{ secrets.SCW_SECRET_TOKEN }}\' --header \'Content-Type:\ application/json\' --data-raw \'{\"registry_image\":\ \"rg.fr-par.scw.cloud/funcscwlandingpaget9xrgx1y/landingpagefront:${{ github.ref_name }}\"}\'

tomtom94 avatar May 04 '22 13:05 tomtom94

This thing works like a charm for me

- name: Patch Scaleway Serverless container front
  uses: wei/curl@v1
  with:
    args: --location --request PATCH https://api.scaleway.com/containers/v1beta1/regions/fr-par/containers/5ad8c796-8cda-4db1-8eb6-60d295f8ed73 --header 'X-Auth-Token:${{ secrets.SCW_SECRET_TOKEN }}' --header 'Content-Type:application/json' --data-raw '{\"registry_image\":\"rg.fr-par.scw.cloud/funcscwlandingpagefn3xcuzy/landingpagefront:${{ github.ref_name }}\"}'

tomtom94 avatar Sep 22 '22 17:09 tomtom94