Perform system import/export command line artifactory - artifactory

I need to know how can I perform a sysyem export/import by command line by artifactory.
Is there any command that will do this task ?
My version of artifactory is 7.29

You can make use of the Import/Export REST API's for this purpose, like below,
Export full system:
curl -H 'Content-Type: application/json' -X POST https://myartifactory/api/export/system -d #export.json
Import full system:
curl -H 'Content-Type: application/json' -X POST https://myartifactory/api/import/system -d #export.json
Also, refer to this KB article on migrating the Arifactory via system import/export and replacing the UI operations with the REST APIs.

Related

API Filter in Visual Studio Code keeps being ignored and requests for everything

I am doing some API integration and im just testing out Celoxis API commands, they use REST API. I have downloaded Visual studio code and installed the rest API add on. Normal cURL commands work etc but the filter request wont:
curl -g -X GET -H 'Content-Type: application/json' -H 'Authorization: bearer YourTokenHere' -G --data-urlencode 'filter={"project.id":"1234"}' 'https://app.celoxis.com/psa/api/v2/tasks'
Any help would be appreciated

How can I set the version of a raw file in a (Sonatype) Nexus raw repository?

I'm making an automatic script to upload a raw file in Nexus, and I need to set up the version of this file. Is this possible? I've been checking the API but it doesn't seem posible.
The command I'm currently using to upload is:
curl --proxy $my-proxy -v --user 'user:pass' --upload-file ./myRawFile 'http://12.34.56.78:1234/repository/MyRawRepo/LoL/TheUploadedFile'
This command is being used from an automatic script (and working) to upload the file, but I don't know how to set the version.
curl -k -u "xxx:xxx" -H 'Content-Type: multipart/form-data' --data-binary "#output.zip" -X PUT https://nexus.xxx.com/repository/{raw-reponame}/xxx/{version}/output.zip
Version number can be change {version}

where to store request.json file

I am trying out Google video intelligent api by following the quick start guide here. I am using cloud shell to run all the codes. In the guide, to make an annotate video request, I need to create a request.json file.
Where to put this file once it's created?
Thanks very much for your help!
The request.json file in this case should be saved in the same directory that you'll make the curl request from in step 2 of that guide. The curl command points to that file at the end:
curl -s -H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
'https://videointelligence.googleapis.com/v1beta1/videos:annotate' \
-d #request.json
The #request.json means it's looking in the current directory for the file.

How can I use the Pingdom API to pause and resume checks from bash?

I'm writing a quick and dirty deployment script and would like to disable and reenable a Pingdom check as part of it. How do I do that using something like cURL?
To pause a check:
curl -X PUT -u 'your#email:yourpassword' -H 'Content-Type: application/json' -H 'App-Key: yourapplicationkey' -d 'paused=true' https://api.pingdom.com/api/2.0/checks/checkid
To resume a check:
curl -X PUT -u 'your#email:yourpassword' -H 'Content-Type: application/json' -H 'App-Key: yourapplicationkey' -d 'paused=false' https://api.pingdom.com/api/2.0/checks/checkid
Replace your#email with your pingdom email.
Replace yourpassword with your pingdom password.
Replace yourapplicationkey with a generated key from the "Sharing" section in your account.
Replace checkid with the numeric ID you see in the browser URL when you click on your check in the Pingdom UI.
You can also use modern way - just API key instead of using also email/password.
First, generate your own API key in https://my.pingdom.com/app/api-tokens and then you can use curl commands like for pausing:
curl -X PUT \
https://api.pingdom.com/api/3.1/checks \
-H 'Authorization:Bearer YOURAPIKEY' \
-d 'paused=true&checkids=777'
or for resuming:
curl -X PUT \
https://api.pingdom.com/api/3.1/checks \
-H 'Authorization:Bearer YOURAPIKEY' \
-d 'paused=false&checkids=777'
Replace YOURAPIKEY with your real API key and 777 with valid check ID.
checkids can be also omitted, then all checks will be modified.

how to post a json file with documents to couchdb

I am trying to post some documents to couchdb by curl and I have succeeded by choosing local file but not http-url... I have trying something like this:
curl -d #http://111.111.11.1/json/myjsonfile -X POST http://127.0.0.1:5984/MyTestDb/_bulk_docs -H "Content-Type: application/json"
I have been trying with many flags and tried many ways but I thing I am missing something. Is there anyone who can help?
The -d option for curl expects a local file only. You'll have to download it first. You could try piping the output of a curl download to a PUT to your CouchDB:
curl http://111.111.11.1/json/myjsonfile | curl -d #- -X PUT http://localhost:5984/MyTestDb....

Resources