I have crafted a curl which looks something like this. It successfully creates a webhook in BitBucket Server, however, it does not set the 'secret' value, and because of this when the webhook is triggered it fails with a 'missing signature in header'.
If I manually set the secret value, it will then work.
I have looked through Bitbucket Server documentation for 'Create webhook'
and do not see anything related.
Link for reference:
https://developer.atlassian.com/server/bitbucket/rest/v804/api-group-repository/#api-api-latest-projects-projectkey-repos-repositoryslug-webhooks-post
url --request POST \
--url 'https://git.example.org/rest/api/latest/projects/DP/repos/demo/webhooks' \
--header 'Authorization: Bearer xxx' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"events": [
"repo:refs_changed"
],
"active": true,
"statistics": {},
"configuration": {},
"url": "http://example.org/push",
"name": "Argo Events"
}'
After opening web tools and manually creating the webhook in the BitBucket website, we inspected the network tab and found that it was stored in the configuration object.
Example curl below.
curl --request POST \
--url 'https://example.org/webhooks' \
--header 'Authorization: Bearer xxx' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"events": [
"repo:refs_changed"
],
"active": true,
"statistics": {},
"configuration": {"createdBy": "bitbucket","secret": "password"},
"url": "http://example.org/push",
"name": "Argo Events"
}'
Related
I want to automatize a task, and the last step is to trigger a webhook on github. I am using ifttt "Make a web request"
This request works with curl
curl --location --request POST 'https://api.github.com/repos/wiso/TemperaturaUfficio/dispatches?event_type=webhook' \
--header 'Accept: application/vnd.github+json' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"event_type": "test_webhook"
}'
I am trying to do the same with ifttt:
I get:
Your server returned a 403. Unable to make web request to https://api.github.com/repos/wiso/TemperaturaUfficio/dispatches?event_type=webhook
I am trying to activate a flow using Tooling REST API. Documentation indicates that this is possible.
But when I try to do it I get this error in http response body:
"message": "You must provide a valid Metadata field for InteractionDefinitionVersion",
"errorCode": "REQUIRED_FIELD_MISSING",
"fields": []
Here is my curl request:
curl --location --request PATCH 'https://XXX.my.salesforce.com/services/data/v55.0/tooling/sobjects/Flow/3015Y000000YJ7pQAG' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer XXX' \
--data-raw '{
"Status": "Active"
}'
I have integrated Jenkins CI with pagerduty. Once I do that, I can see intergration key generated.
That will be used in jenkins to send the events to pagerduty.
The requirement is to rotate the keys after some time. I want to automate this.
Is there any api to regenerate the intergration key and return the key in response to be stored in jenkins?
I think the simplest solution here is to use the REST API -- it isn't possible to regenerate the integration key directly, but you can delete the integration and create a new one programmatically.
First fetch the service details:
curl --location --request GET 'https://api.pagerduty.com/services/<service_id>' \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Authorization: Bearer <bearer_token>'
This will include all of the integrations on the service -- make note of the integration_id and the vendor_id.
The delete endpoint isn't documented but it does seem to exist:
curl --location --request DELETE 'https://api.pagerduty.com/services/<service_id>/integrations/<integration_id>' \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Authorization: Bearer <bearer_token>'
And finally you can create the new integration, using the vendor_id from the GET request:
curl --request POST \
--url https://api.pagerduty.com/services/id/integrations \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Authorization: Bearer <bearer_token>' \
--header 'Content-Type: application/json' \
--data '{
"integration": {
"type": "generic_email_inbound_integration",
"name": "Email",
"service": {
"id": "<service_id>",
"type": "service_reference"
},
"integration_email": "my-email-based-integration#subdomain.pagerduty.com",
"vendor": {
"type": "vendor_reference",
"id": "<vendor_id>"
}
}
On doing inspect element to UI button
Its executing POST API:
https://xxxxxxx.pagerduty.com/api/v1/services/XXXXXXX/integrations/XXXXXXX/regenerate_key
I'm trying to communicate with an SMTP API from my IOS application. The API uses HTTPS requests, however, I'm unsure how to make one within Swift. The application exemplifies the following cURL request as a way of communicating with the API:
curl --request POST \
--url https://api.sendinblue.com/v3/smtp/email \
--header 'accept: application/json' \
--header 'api-key:YOUR_API_KEY' \
--header 'content-type: application/json' \
--data '{
"sender":{
"name":"Sender Alex",
"email":"senderalex#example.com"
},
"to":[
{
"email":"testmail#example.com",
"name":"John Doe"
}
],
"subject":"Hello world",
"htmlContent":"<html><head></head><body><p>Hello,</p>This is my first transactional email sent from Sendinblue.</p></body></html>"
}'
How can I make this request from my code project?
Any help would be greatly appreciated!
I want to update a couchbase document with REST API
ilceabcd1233.corp.abcd.com:8091/pools/default/buckets/{bucketName}/docs/{documentId}
When I hit below CURL command in postman, I receive 200 OK response Code with response as blank json Array: []
CURL:
curl --location --request POST 'ilceabcd1233.corp.abcd.com:8091/pools/default/buckets/{bucketName}/docs/{documentId}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9yff' \
--data-raw '{"name": "Nisarg", "age": 50}'
When I retrieve this document by below CURL:
curl --location --request GET 'ilceabcd1233.corp.abcd.com:8091/pools/default/buckets/{bucketName}/docs/{documentId}' \
--header 'Accept: application/json' \
--header 'Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9yff'
it responds:
{
"meta": {
"id": "112176152456",
"rev": "4-1637ac65ed7900000000000002000006",
"att_reason": "invalid_json",
"expiration": 0,
"flags": 33554438
},
"base64": "",
"xattrs": {}
}
On Couchbase web console I see message:
"Binary document. Base64 not available"
Can any one please help, what I am doing wrong ?
The trick here is that this API doesn't actually accept JSON. It's looking for application/x-www-form-urlencoded. Otherwise it will assume you are storing a binary document. You actually need a form value, which itself contains JSON. For example:
curl --location --request POST 'http://localhost:8091/pools/default/buckets/demo/docs/doc1' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
--header 'Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==' \
--data-urlencode 'value={"foo": "bar"}'
And just to echo my comment, this is an undocumented, unsupported endpoint that's really meant for internal use only. It's recommended instead to use an SDK (like the Couchbase Java SDK, for instance) to read/write documents. The REST API is intended for Cluster management, not for CRUD.