I would like to add the Databricks init script API in my exsiting bash script. How can I do this? Here is the API provided by Databricks:
curl -n -X POST -H 'Content-Type: application/json' -d '{
"cluster_id": "",
"num_workers": 1,
"spark_version": "8.4.x-scala2.12",
"node_type_id": "$node_type",
"cluster_log_conf": {
"dbfs" : {
"destination": "dbfs:/cluster-logs"
}
},
"init_scripts": [ {
"dbfs": {
"destination": "dbfs:/FileStore/shared_uploads/kafka_keytabs/CopyKrbFiles.sh"
}
} ]
}' https://<databricks-instance>/api/2.0/clusters/edit
Related
I have a bitbucket pipeline that will be triggered from outside:
custom:
# This Pipeline will be triggered automatically when the setup succeeds
test-deployment:
- variables:
- name: build_number
- step:
name: "Test"
image: atlassian/default-image:latest
script:
- echo $build_number
- export
I have to pass the parameter "build_number" to this pipeline and I tried this with the following call:
curl -X POST -is -u user:pass \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/user/repo/pipelines/ \
-d '
{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "feature/pipeline-tests",
"selector": {
"type": "custom",
"pattern" : "test-deployment"
}
}
},
"variables": [
{
"key" : "build_number",
"value" : "202"
}
]
}'
But the "build_number" was not set. If I call the pipeline via the Bitbucket UI it works. What's wrong here?
I think you could try adding the missing parameter "secured":
{
"key" : "build_number",
"value" : "202",
"secured": False
}
Is there a way to create multiple invoices with a single POST request to the NetSuite REST API?
The API Reference doesn't mention anything - but I'm hoping there's a way to avoid sending thousands of individual requests.
I am creating a single invoice like this (some headers have been removed):
curl --location --request POST 'https://{{COMPANY_URL}}.suitetalk.api.netsuite.com/services/rest/record/v1/invoice' \
--header 'Content-Type: application/json' \
--data-raw '{
"entity": {
"id": 46
},
"item": {
"items": [
{
"item": {
"id": 134
},
"amount": 20
}
]
}
}'
I have created a contentful model called "User" with two fields:
id - text, unique, required
email - text, optional
When I try to create a new entry via content management API using these parameters:
Headers:
X-Contentful-Content-Type : user
Content-Type : application/vnd.contentful.management.v1+json
Method
PUT
URL
https://api.contentful.com/spaces/qilo7tiaixh8/environments/entries/
Body:
{
"id":"whatever",
"email": "peter#petervukovic.com"
}
I get the following error:
{
"requestId": "2849bbcd7ee0486bb36b47927071f37b",
"sys": {
"type": "Error",
"id": "UnknownKey"
},
"message": "The body you sent contains an unknown key.",
"details": {
"errors": [
{
"keys": [
"id",
"email"
]
}
]
}
}
I have no idea what I'm doing wrong as the examples in the official documentation aren't helpful (they assume multi-lingual content I'm not using) and there are no debugging hints.
Contentful DevRel here. 👋
I just tried it and the following CURL works for me on a user content type that defines a title field.
curl --include \
--request PUT \
--header 'Authorization: Bearer ...' \
--header 'Content-Type: application/vnd.contentful.management.v1+json' \
--header 'X-Contentful-Content-Type: user' \
--data-binary '{
"fields": {
"title": {
"en-US": "Hello Test"
}
}
}' \
https://api.contentful.com/spaces/.../environments/master/entries/\test-1
It looks like you were missing to include the fields property in your payload. About the localization part, I think it's required to provide the locale for your field values. So in my example, en-US is the default value and it is required.
For using PUT you have to define or come up with an entry id.
To create an entry without passing and defining an id have a look at the docs in Entry collection.
curl --include \
--request POST \
--header 'Authorization: Bearer ...' \
--header 'Content-Type: application/vnd.contentful.management.v1+json' \
--header 'X-Contentful-Content-Type: user' \
--data-binary '{
"fields": {
"title": {
"en-US": "Hello Test 2"
}
}
}' \
https://api.contentful.com/spaces/.../environments/master/entries/
Am trying to run multiline curl command in shell but not able to run it
curl -XPUT 'elk.***.com:9200/_snapshot/my_backup' \
{
"type": "fs",
"settings": {
"location": "/elkprod_bak/elkback",
"compress": true
}
}
You need to use the -d switch on the command line like this:
curl -XPUT 'elk.***.com:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {
"location": "/elkprod_bak/elkback",
"compress": true
}
}'
I have an issue with the web interface. I'm using powerdns v3.4.5 with mysql as the back-end.
I have followed instructions from here:
https://www.unixmen.com/how-to-install-powerdns-on-ubuntu-14-04/
I have successfully installed powerdns with mysql and got the web-api to work.
However I have trouble inserting A records using the REST api.
I have followed command from here:
https://doc.powerdns.com/md/httpapi/README/
This creates a new zone:
curl -X POST --data '{"name":"example.org.", "kind": "Native", "masters": [], "nameservers": ["ns1.example.org.", "ns2.example.org."]}' -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones | jq .
(note that I changed the url and removed /api/v1/)
However when I run the following command to add a new A record:
curl -X PATCH --data '{"rrsets": [ {"name": "test.example.org.", "type": "A", "ttl": 86400, "changetype": "REPLACE", "records": [ {"content": "192.0.5.4", "disabled": false } ] } ] }' -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones/example.org. | jq .
I get the following error:
"error": "RRset test.example.org. IN A: Name is out of zone"
is there anything that I'm missing?
It should be as follows:
curl -X POST --data '{"name":"example.org", "kind": "Master","dnssec":false,"soa-edit":"INCEPTION-INCREMENT","masters": [], "nameservers": ["ns1.example.org"]}' -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones | jq .
and then:
curl -X PATCH --data '{"rrsets": [ {"name": "test.example.org", "type": "A", "changetype": "REPLACE", "records": [ {"content": "192.168.9.9", "disabled": false, "name": "test.example.org", "ttl": 86400, "type": "A", "priority": 0 } ] } ] }' -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones/example.org | jq .
As time passes by, the API changed. The current json structure is a little bit different, also power-dns insists of getting canonical names ending with a dot.
# cat example_zone.json
{
"kind": "Native",
"masters": [],
"name": "example.com.",
"nameservers": [
"ns1.example.com.",
"ns2.example.com."
]
}
# curl -s -H 'X-API-Key: changeme' --data #example_zone.json http://127.0.0.1:8081/api/v1/servers/localhost/zones
# cat example_rrset.json
{
"rrsets":
[
{
"name": "test.example.com.",
"type": "A",
"changetype": "REPLACE",
"ttl": 86400,
"records":
[
{
"content": "192.168.9.9",
"disabled": false,
"name": "test.example.com.",
"type": "A",
"priority": 0
}
]
}
]
}
# curl -v -X PATCH -H 'X-API-Key: changeme' --data #example_rrset.json http://127.0.0.1:8081/api/v1/servers/localhost/zones/example.com.