invalid_payload while passing variable in slack POST CURL command in gitlab.ci.yml - gitlab-ci

I am keep on getting invalid_payload and not able to trigger email to Slack channel.
send_email:
stage:notify
when:always
variables:
PASSED_COUNT: "'{\"passed\":1}'"
DEPLOY_CURL_COMMAND: 'curl -X POST -H "Content-type:application/json" --data $PASSED_COUNT https://hooks.slack.com/services/xxxxx/xxxxxxx/..'
script:
- echo "Testing Platform"
- echo $DEPLOY_CURL_COMMAND
- 'eval "$DEPLOY_CURL_COMMAND"'
- curl -X POST -H 'Content-type:application/json' --data '{"text":"'$PASSED_COUNT'"}' https://hooks.slack.com/services/xxxxx/xxxxxxx/..'

Related

curl post fail all time

hello i'm trying this guide but it fail all time
https://github.com/ubahnverleih/WoBike/blob/master/Beam.md
To login, I need to get OTP code but i can't access to it
curl -d "phoneNumber=[phonenumber]countryCode=+[countrycode]" \
-H "Content-Type:application/json" \
-H "User-Agent:escooterapp/latest-app-version;ios" \
-X POST https://gateway.ridebeam.com/api/auth/phoneverification
but it sends message like this
{"success":false,"message":"There was some error","response":{},"error":"","data":{}}
i don't know why this fail
is my code grammarly wrong?
The tutorial and the curl command say it's an application/json and you are passing an incorrect format in the data. Pay attention at the beginning of the command curl -d ...
Correct:
curl -d '{"phoneNumber":"<phone-number>","countryCode":"+<country-code>"}' \
-H "Content-Type:application/json" \
-H "User-Agent:escooterapp/latest-app-version;ios" \
-X POST https://gateway.ridebeam.com/api/auth/phoneverification
Wrong:
curl -d "phoneNumber=[phonenumber]countryCode=+[countrycode]" \
-H "Content-Type:application/json" \
-H "User-Agent:escooterapp/latest-app-version;ios" \
-X POST https://gateway.ridebeam.com/api/auth/phoneverification
Execution:
curl -d '{"phoneNumber":"123123123","countryCode":"+55"}' \
-H "Content-Type:application/json" \
-H "User-Agent:escooterapp/latest-app-version;ios" \
-X POST https://gateway.ridebeam.com/api/auth/phoneverification
{"message":"PhoneVerificationServiceErrorDomain","messageKey":1,"messageArgs":"{"status":400,"message":"Invalid
parameter To:
+55123123123","code":60200,"moreInfo":"https://www.twilio.com/docs/errors/60200"

Github actions temporary variable cant be interpreted

in my Github action I use a temporary variable for a timestamp and want to send this variable in a webhook, but github cant interpret the $var in string. Can someone pls help me?
The code looks like this:
- name: Posting Rocketchat
if: failure()
run: |
TS=$(date +%Y%m%d%H%M%S)
curl -X POST -H 'Content-Type: application/json' --data '{"text":"❌ Test: Leads Testing Desktop 💻","image_url":"https://myurl.net/$TS-1.png"}' https://chat.myurl.com/hooks/yxyxyxxyxyxyx/xxxxxyxyxyxyxyxyxy
Use instead
- name: Posting Rocketchat
if: failure()
run: |
echo "TS=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
curl -X POST -H 'Content-Type: application/json' --data '{"text":"❌ Test: Leads Testing Desktop 💻","image_url":"https://myurl.net/${{ env.TS }}-1.png"}' https://chat.myurl.com/hooks/yxyxyxxyxyxyx/xxxxxyxyxyxyxyxyxy

Apicurio registry - Documentation tab for artifact is empty

When I upload artifact to the ApiCurio registry using UI it works fine but if I use CURL for the same artifact, Documentation tab is empty. Any ideas?
I use:
curl -X POST -H "Content-type: application/json" -H "X-Registry-ArtifactType: OPENAPI" -H "X-Registry-ArtifactId: test" --data "{$body}" http://registry:8080/api/artifacts
should use "$body" instead of "{$body}"

Is it possible to do test state.apply through salt-api?

Is there a way to do:
salt '*' state.apply nginx test=True
through salt-api ?
I'm doing this:
curl -sSk http://salt:8000
-H 'Accept: application/x-yaml'
-H 'X-Auth-Token: token'
-d client=local
-d tgt='*'
-d fun=state.apply
-d arg=nginx
-d test=True
but it actually applies new state.
Thanks in advance!
what about curl -sSk http://salt:8000/run instead of curl -sSk http://salt:8000
and are you using \ at the end of each option?
otherwise it looks good, what version of salt are you running?
https://salt-sproxy.readthedocs.io/en/latest/salt_api.html <= good reading
Finally, I found a way to do state.apply through salt-api with test option.
All I needed was: -d arg='test='true''
Example of full request:
curl -sSk http://salt:8000 \
-H 'Accept: application/x-yaml' \
-H 'X-Auth-Token: token' \
-d client=local \
-d tgt='*' \
-d fun='state.apply' \
-d arg='nginx' \
-d arg='test='true''

Create a BitBucket Team repository using the api

I need to create a Team repository usign Bitbucket's API.
To create a user repository I use to do so:
$ curl -k -X POST -u username:passwd "https://api.bitbucket.org/1.0/repositories" -d "name=myrep"
How would I do the same but for a team?
This explains how it works with the repositories endpoint of API 2:
$ team=myteam
$ repo=repository
$ curl -X POST -v -u username:password -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/${team}/${repo} \
-d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }'
The difference from API 1 regarding how the data (-d) is handled is that API2 uses JSON format.