get list of all dependencies of Spring Initializr, using curl - spring

In the official doc, it tells how to use curl to create a spring project.
eg,
curl https://start.spring.io/starter.zip -d dependencies=web,devtools \
-d bootVersion=2.1.9.RELEASE -o my-project.zip
My question is, how can I use curl to get the list of all dependencies?
the output should be look like something below
# output of `curl ...` to get all dependencies of Spring Initializr
...
web
devtools
...

Maybe it's too late and you don't need anymore, but can be helpful to the others...
There is a url that's retrieve relevant info, like version, options and dependencies.
curl -H 'Accept: application/json' https://start.spring.io
If you want to filter only the names of dependencies, with jq help, you can request using this command:
curl -H 'Accept: application/json' https://start.spring.io | jq '.dependencies.values[].values[].id'
The result is something like this:
"devtools"
"lombok"
"configuration-processor"
"web"
"webflux"
"data-rest"
"session"
"data-rest-explorer"
"data-rest-hal"
...

Related

Spring boot and RAML

I tried to build and run this project
https://github.com/adorsys/raml-springboot-example
I build the project as right click and Maven install.That time raml-springboot-impl.jar is not generating under raml-springboot-impl project.
Do you have any idea about this.
Try to type or copy+paste the following commands in the terminal/bash as shown in the git repos README.md:
(I'll post my example from Mac, you'll probably have to modify it sensibly)
cd to the repo-s root:
cd /Users/username/Documents/RAML/raml-springboot-example
generate the package:
mvn clean package
run project:
java -jar raml-springboot-impl/target/raml-springboot-impl.jar
Create a new Todo:
curl -i -X POST -H 'Content-Type: application/json' -d '{ "task": "Design the API", "priority": 1 }' localhost:8080/api/todos
List all Todos
curl -i -H 'Accept: application/json' localhost:8080/api/todos
Get one Todo by id
curl -i -H 'Accept: application/json' localhost:8080/api/todos/1
If you feel more comfortable if you can see stuff in the browser, you can just paste the last two links in Chrome or whatever you're using ;)
Also, you can try https://www.getpostman.com/ for testing endpoints that accept other than 'GET' requests (like the first one here) ;)

TeamCity API setting configuration parameters

I have configuration parametr current_build_date (User Defined Parameter) I want just to set this parameter to current date by API TeamCity.
On docs I have seen this:
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/parameters/<parameter_name>
I know my Build configuration ID, but I can't understand how by this to make buildTypeLocator.
I assume result will be something like this:
curl -u Login:Password \
-X PUT \
-d 'valueOfMyParam' \
-H 'Content-Type: text/plain' \
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/parameters/current_build_date
I will realy appreciate if somebody who knows TeamCity API will help me with this problem.
I made attempt just to pass instead of buildTypeLocator my Build configuration ID and I got ERROR:
[17:08:25][Step 3/3] Error has occurred during request processing (Not Found).
[17:08:25][Step 3/3] Error: jetbrains.buildServer.server.rest.errors.NotFoundException: No project found by name or internal/external id 'BuildConfigurationID'.
If there are any problems or ambiguities with my question please add comment, i'll try to fix it.
If you browse the REST API endpoints in a browser you'll be able to see the format of the build locator.
Visit http://teamcity:8111/httpAuth/app/rest/buildTypes/ and you'll see the entries have a href attribute that contains the buildLocator (generally a property:value combination)
You'll then be able to navigate using that url / communicate via the API
Hope this helps
I solved problem: build type locator was id:Build configuration ID
current_build_date=`date +%%Y-%%m-%%d:%%H:%%M:%%S`
echo $current_build_date;
curl -u Login:Password \
-X PUT \
-d $current_build_date \
-H 'Content-Type: text/plain' \
https://teamcity.billing.ru/httpAuth/app/rest/buildTypes/id:Build
configuration ID/parameters/current_build_date

Parse server response "Unexpected token"

I'm working on putting a Parse Server on Heroku. I'm using this app:
https://github.com/ParsePlatform/parse-server-example
Uploading to heroku using this guide:
https://devcenter.heroku.com/articles/getting-started-with-nodejs
I've updated the db and server URLs in the parse server code, and everything uploads and deploys properly. However, when I attempt to use cURL to test the server as indicated in this guide:
https://github.com/ParsePlatform/parse-server
I get the following error:
{"error":"Unexpected token '"}
I have copied and pasted the cURL command, modified for my url:
curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://my-app-name.herokuapp.com/parse/classes/GameScore
Heroku logs show the request coming in (so I know it's going to the right place) but no errors. I'm deploying from Windows 7, if that matters. This is my first experience with heroku and parse server so I'm kind of flying blind. Anybody see the problem?
Try to invert simple quote to double quote for your POST data field, it's work for me :
#here : "{'score':1337,'playerName':'Sean Plott','cheatMode':false}"
curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d "{'score':1337,'playerName':'Sean Plott','cheatMode':false}" http://my-app-name.herokuapp.com/parse/classes/GameScore
instead
#here : '{"score":1337,"playerName":"Sean Plott","cheatMode":false}'
curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://my-app-name.herokuapp.com/parse/classes/GameScore
I had that issue - for me the fix was is I was using a restApi key which is no longer needed in the Parse-Server.
It was also affecting my s3 adapter - was not allowing me to upload any images through dashboard.
I removed the restApi key and everything started working.

Load GeoJSON file into Apache CouchDB

I am working on Windows10 and tried to load a geojson file into my couchdb via the "curl" command and a POST request in the cmd which looks like that:
C:\Program Files\cURL\bin>curl -d #path-to-my-data\data.geojson -H "Content-type: application/json" -X POST http://127.0.0.1:5984/_utils/database.html?-dbName-
and then I get the following error:
{"error":"method_not_allowed","reason":"Only GET,HEAD allowed"}
On http://couchdb-13.readthedocs.org/en/latest/api-basics/ it is said, that "If you use the an unsupported HTTP request type with a URL that does not support the specified type, a 405 error will be returned, listing the supported HTTP methods."
When I try that with a PUT request, I get the same error.
I validated the json with jsonlint so this should not be the problem.
I tried several tutorials like "Three Steps to CouchDB Heaven …" or "Export & Import a Database with CouchDB" but none of them seems to work.
So I am not sure, where the problem is. Do I need to make changes in my geojson file, or something else?
thanks for your help
The needed curl command just looks like that:
curl -H "Content-Type: application/json" -X POST http://localhost:5984/db -d #C:\Users\Name\Desktop\data.geojson

How do I send multiple payloads at once to SendGrid's API in Ruby?

From following their API docs, the curl command to interact with their API should look something like this:
curl -X POST https://api.sendgrid.com/apiv2/reseller.manage.json \
-d api_user=reseller#company.com \
-d api_key=XXXXXXXX \
-d user=reseller_customer#company.com \
-d password=customernewpassword \
-d confirm_password=customernewpassword \
-d method=password
How do I write that in Ruby?
You'll want to look at the RestClient gem. It makes it easy to send requests like this.
https://github.com/rest-client/rest-client
You could use the SendGrid API by using ruby to curl the url. If you aren't constrained to using curl, you should take a look at the official ruby gem though https://github.com/sendgrid/sendgrid-ruby
Use the Sendgrid SMTP API, there are code examples in their docs; see here for example, https://sendgrid.com/docs/Integrate/Code_Examples/ruby.html.

Resources