Following what says here, I got a connection refused using this curl:
curl -v -H "Content-Type: application/json" -H "Accept: application/xml" -H "X-Auth-Token: 756cfb31e062216544215f54447e2716" -H "Tenant-Id: your-tenant-id" -X POST "http://saggita.lab.fi-ware.org:8080/sdc/rest/vdc/{your-tenant-id}/productInstance"
I changed it to what seems the appropriate URL:
cat test-data | curl --insecure -v -H "Content-Type: application/json" -H "Accept: application/xml" -H "X-Auth-Token: 756cfb31e062216544215f54447e2716" -H "Tenant-Id: your-tenant-id" -X POST "https://saggita.lab.fi-ware.org:8443/sdc/rest/vdc/{your-tenant-id}/productInstance" --data-binary #-
Comment: I used the file test-data as payload, I show later what payload I am using.
With that petition (with the appropriate auth token and specific parameters for my environment) I got:
Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
Seems is expecting JSON instead of XML, so I rearranged like this:
cat test-data | curl --insecure -v -H "Content-Type: application/xml" -H "Accept: application/xml" -H "X-Auth-Token: 756cfb31e062216544215f54447e2716" -H "Tenant-Id: your-tenant-id" -X POST "https://saggita.lab.fi-ware.org:8443/sdc/rest/vdc/{your-tenant-id}/productInstance" --data-binary #-
And I got this message no matter how I change payload:
{"message":"The entity is not valid","code":42}
I tried this two payloads (with the example of installing apache):
<productInstanceDto>
<vm>
<ip>MYIP</ip>
<fqn>same as hostname, I don't have DNS resolution</fqn>
<hostname>MYHOSTNAME</hostname>
</vm>
<product>
<productDescription/>
<name>apache2</name>
</product>
<attributes>
<key>custom_att_02</key>
<value>default_value_plain</value>
<type>Plain</type>
</attributes>
</productInstanceDto>
What I see as a very minimialist and clear payload
<productInstanceDto>
<vm>
<ip>MYIP</ip>
</vm>
<product>
<name>apache2</name>
</product>
</productInstanceDto>
By the way, I see so unfortunate fields like fqdn (could be missing, no dns resolution on that server), version (why I have to know the version of the product I want to install, this does not appear in the Product Catalogue), the missing of VM_ID parameter: available, easy and unique.
What I'm doing wrong?
Thanks
You are using the FIWARE Lab infrastructure for using the SDC component. However, they are some requirements to install software inside the VM, for instance, having chef/puppet installed, to have the VM registered in the chef-server (you can have a look at https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Software_Deployment_%26_Configuration_-_Installation_and_Administration_Guide). Thus, my suggestion if you want to use SDC in FIWARE Lab infrastructure is that you use the blueprint capabilities in the cloud portal (cloud.lab.fiware.org), which deploy the VMs, prepare the VMs, register the VMs in the chef-server and so on. You can have a look at the video blueprints in http://help.lab.fiware.org/.
Related
While creating a user using SCIM1.1 endpoint with email.
curl -v -k --user admin:admin --data '{"schemas":[],"name":{"familyName":"gunasinghe","givenName":"hasinitg"},"userName":"hasinitg_sample","password":"hasinitg","emails":[{"primary":true,"value":"hasini_home.com"}]}' --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
Created User response:
{"emails":[{"value":"hasini_home.com"}],"meta":{"created":"2018-09-18T15:43:17","location":"https://localhost:9443/wso2/scim/Users/37f051b2-770c-4915-9a3f-623a7404b2a4","lastModified":"2018-09-18T15:43:17"},"schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"gunasinghe","givenName":"hasinitg"},"id":"37f051b2-770c-4915-9a3f-623a7404b2a4","userName":"hasinitg_sample"}
Retrieve the USER from SCIM endpoint:
curl -v -k --user admin:admin https://localhost:9443/wso2/scim/Users/37f051b2-770c-4915-9a3f-623a7404b2a4
The response is:
{"meta":{"created":"2018-09-18T15:43:17","location":"https://localhost:9443/wso2/scim/Users/37f051b2-770c-4915-9a3f-623a7404b2a4","lastModified":"2018-09-18T15:43:17"},"schemas":["urn:scim:schemas:core:1.0"],"roles":["Internal/everyone"],"name":{"familyName":"gunasinghe","givenName":"hasinitg"},"id":"37f051b2-770c-4915-9a3f-623a7404b2a4","userName":"hasinitg_sample"}
The email is missing here in the response and My-Sql DB as well. Any idea?
The issue seems to be that if you are sending the email as a JSON object, you have to set the type as well. Following debug log is written when we send an email object without the type attribute.
TID: [-1234] [] [2018-09-19] DEBUG
{org.wso2.carbon.identity.scim.common.utils.AttributeMapper} - Type
attribute cannot be null for sub attribute:
org.wso2.charon.core.attributes.ComplexAttribute#71ebf24c of Complex
MultiValuedAttribute: emails. Skip adding as a claim
Please see the given sample request in the documentation
{"primary":true,"value":"hasini_home.com","type":"home"}
You can use the following request to simply solve your problem.
curl -v -k --user admin:admin --data '{"schemas":[],"name":{"familyName":"gunasinghe","givenName":"hasinitg"},"userName":"hasinitg_sample","password":"hasinitg","emails":"hasini_home.com"}' --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
Hi :) I'm trying to mimic the oc cli API call to the master node that initiates a deployment. So eventually, I can have a chatbot that can initiate a deployment without needing to install the oc cli.
What is the API call to initiate a deployment?
When I look at what the oc cli is doing with oc deploy <app> --latest --loglevel=9. I see it fetching information only:
curl -k -v -XGET -H "Authorization: Bearer <token>" -H "User-Agent: oc/v1.3.0 (darwin/amd64) openshift/d451518" -H "Accept: application/json, */*" https://<host>:<port>/oapi/v1/namespaces/<namespace>/deploymentconfigs/<app>
curl -k -v -XGET -H "User-Agent: oc/v1.3.0+52492b4 (darwin/amd64) kubernetes/52492b4" -H "Authorization: Bearer <token>" -H "Accept: application/json, */*" https://<host>:<port>/api/v1/namespaces/<namespace>/replicationcontrollers/<app>-15
Where does it make the call to initiate the deployment? And how do I mimic it?
I wasn't able to find anything in these docs:
https://docs.openshift.org/latest/rest_api/openshift_v1.html
https://docs.openshift.org/latest/rest_api/kubernetes_v1.html
Thank you for your time!
Not sure if this is where you are wanting to go but your maybe looking for this
create instantiate of a DeploymentRequest
POST /oapi/v1/namespaces/{namespace}/deploymentconfigs/{name}/instantiate
https://docs.openshift.org/latest/rest_api/openshift_v1.html#create-instantiate-of-a-deploymentrequest
https://docs.openshift.org/latest/rest_api/openshift_v1.html#v1-deploymentrequest
I'm following the tutorial at Retrieve and Rank - Get Started, and I'm at the following step:
Issue the following command to upload the cranfield_data.json data to the example_collection collection. Replace {username}, {password}, {solr_cluster_id}, and {/path_to_file} with your information:
$ curl -X POST -H "Content-Type: application/json" -u "{username}":"{password}" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/{solr_cluster_id}/solr/example_collection/update" --data-binary #{/path_to_file}/cranfield_data.json
I'm lobbing the request with the correct username and password, and correct cluster_id and path to the json, but I get the following error:
$ curl -X POST -H "Content-Type: application/json" -u "username":"password" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/cluster_id/solr/example_collection/update" --data-binary #forum_data/parsed_answers.json
Error: WRRCSH006: Error forwarding request [/solr/example_collection/update] for Solr cluster [sc5b47c5e3_bab3_4aff_a818_f0d786d6dece].
Turns out there were characters in the JSON causing it be malformed.
Just verify the JSON "parsed_answers.json", to check for all the punctuations i.e. ";","," to be correctly placed and as per the defined schema, and try to re-upload
I want to use the pushbullet api (v2/push) for pushing messages, but if I include '%' character inside title or body the server gives me the following error:
{"error":{"type":"invalid_request","message":"Failed to decode urlencoded POST form body.","cat":"~(=^‥^)ノ"}}
How can I fix this problem?
request: curl https://api.pushbullet.com/v2/pushes -k -u token: -d type=note -d title="%test" -d body="%%test" -X POST
x-www-form-urlencoded is not the most straightforward of formats. You can probably use curl with the --data-urlencode option. You can also try encoding your values with this tool: http://meyerweb.com/eric/tools/dencoder/
That should produce urlencoded output, for instance your request would look more like:
curl -u token: https://api.pushbullet.com/v2/pushes --header "Content-Type: application/x-www-form-urlencoded" --data-binary 'type=note&title=TITLETEXT&body=%25BODYTEXT'
My Url is Like:
https://<ip:port>/TestRESTServices/objects/test-folder
JSON data that I want to pass is:
{
"name":"test-1",
"parent-uuid":"126"
}
test-1 is the folder name which i want to create.
When i invoke this url with the data in Poster plugin in firefox via POST it works fine and folder test-1 is created.
//using Content Type : "application/json"
How can I invoke/call this REST API using cURL ?
Need Help.
This is what i tried:
curl -i -H "Accept: application/json" -X POST -d '{"name":"test-1","parent-uuid":"126"}' https://<ip:port>/TestRESTServices/objects/test-folder
It throws an error that curl: (52) Empty reply from server
Unfortunately I don't have a REST API online to try it, but resources that I found suggest the following approaches:
curl -v -H "Content-Type: application/json" -X POST --data "#issue.json" -u login:password http://redmine/issues.json
where the issues.json is a file containing the JSON request.
Resources I found useful:
1, 2
Hope it helps!
For Authentication : Give the userid/password as admin:password
TOKEN=$(curl -s -k -X POST --basic -u "admin:password" "{host}/TestAuthServices/auth/tokens" | sed -rn 's/\{"Token":"([^"]+)".+/\1/p')
After getting this token call curl as:
curl -s -k -X POST -H "Content-Type: application/json" -H "Authorization: X-SAML ${TOKEN}" -d '{"name":"test","parent-uuid":"126"}' "{host}/TestRESTServices/objects/test-folder"