Google CardDAV API - getting users addressbook - addressbook

Trying to use the Google CardDAV API to get at user's address books under my account. I have successfully gathered the base info for the principal user (PROPFIND current-user-principal), and the Home Set and addressbook of the principal, as defined in the Google CardDAV API document. I have users within the principal account, and I want to get the addressbook of those users. The documentation, and what info I have managed to wring out of the RFCs, suggests that I might use:
curl --request PROPFIND \
--header "Content-Type: text/xml" \
--header "Depth: 1" \
--header "Authorization: Bearer ya29.wwAiN8Xex0IrvCJx5_zRgB1RdO5iFeH7cyYzpU_3aPRZIDi9Q5j1mSmzk9IqqcbwIWEnJijNPOqysOnDqTpt7Ie6Ef9b7WrBLVDCTuNKfhjA2m6m7w604CDm" \
--data-ascii "<?xml version=\"1.0\" encoding=\"utf-8\"?> \
<D:propfind xmlns:D=\"DAV:\"> \
<D:prop> \
<D:current-user-principal /> \
<D:principal-URL /> \
<D:resourcetype /> \
</D:prop> \
</D:propfind>" \
https://www.googleapis.com/carddav/v1/principals/<USER EMAIL>/lists/default
But that gives me:
<?xml version="1.0" encoding="UTF-8"?>
<errors xmlns="http://schemas.google.com/g/2005">
<error>
<domain>GData</domain>
<code>notFound</code>
<internalReason>Not Found</internalReason>
</error>
</errors>
Thoughts?
thanks,
Andy

Related

Grafana: Datasource (Prometheus ) query 403

When querying Datasource from grafana getting 403 for a few of the metrics.
curl --location --request GET 'https://xxx.xxx.xxx/api/datasources/proxy/1/api/v1/query?query=sum(kube_pod_container_status_restarts_total%7Bnamespace%3D%22default%22%2C%20container%3D~%22al-agent-container%22%2C%20pod%3D%22al-agent-container-hlrz2%22%7D)&time=1607489911' \
> --header 'Accept: application/json' \
> --header 'Content-Type: application/json; charset=UTF-8' \
> --header 'Authorization: Bearer xxx' \
> --data-raw ''
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>
When Querying from the Prometheus server endpoint with same query it resolves with 200:
curl --location --request GET 'http://kube-system-prometheus-server.kube-system.svc.cluster.local/api/v1/query_range?query=sum(kube_pod_container_resource_requests_cpu_cores%7Bnamespace%3D%22default%22%2C%20pod%3D~%22al-agent-container-hlrz2%22%7D)&start=1607488035&end=1607489835&step=15' \
> --header 'Accept: application/json' \
> --header 'Content-Type: application/json; charset=UTF-8'
{"status":"success","data":{"resultType":"matrix","result":[]}}
Grafana Version: v6.6.2 (3fa63cfc34)
Prometheus does not have any authentication in place,
This issue is facing only for few metrics not for all.
When tested the data source from its configuration section. it shows it's all working.
does anyone have any idea on this?
I have found this issue,
I had WAF enabled in the entry LB, I have removed and checked that it does work.
WAF is considering this as SQL injection and hence blocking it.
From my view , you cant get the data from Grafana. Because Grafana doesn't have DB place to store the data . It will use the Existing database from any other source to plot the Time-based series.

Response from realex: No request type specified

I'd like to make test request for paypal payment with realex.
Request looks like:
curl -X POST \
https://test.realexpayments.com/epage-remote.cgi \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/xml' \
-H 'Postman-Token: b83626b9-9472-25d6-cb36-6143a480bf69' \
-d '<?xml version="1.0" encoding="UTF-8"?><request type="payment-set" timestamp="20180222134621"><merchantid>realexsandbox</merchantid><account>internet</account><orderid>IgGjoyQSRXqRyIvG30S5zQ</orderid><amount currency="EUR">1001</amount><autosettle flag="1"/><sha1hash>1524dcf16adca3af772ff4d6a035dd3789d5a4e9</sha1hash><paymentmethod>paypal</paymentmethod><paymentmethoddetails><ReturnURL>https://www.example.com/success</ReturnURL><CancelURL>https://www.example.com/failure</CancelURL></paymentmethoddetails><sha1hash>2d630f0d401ee62c711db6ab37b79f2ad43f201e</sha1hash></request>'
Body looks fine, possibly endpoint https://test.realexpayments.com/epage-remote.cgi is not the right one, as I always get response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response timestamp="20180223104630">
<result>503</result>
<message>No request type specified</message>
</response>
Can anybody help me with that?
Thanks for your question. When testing PayPal please use the following endpoint:
https://api.sandbox.realexpayments.com/epage-remote.cgi
The test.realexpayments endpoint is just for quickly testing card payments when you don't have a Sandbox account.
Best,
Seán
Realex Payments

"The revision must be specified." error with status 400 Bad Request when delete controller-services and connections

I try export and import nifi templates via nifi rest api; but when i tried to delete controller-services, connections or import a template i get the response message "The revision must be specified." with '400 bad request' status from nifi rest api. I didn't understand what i have to do.
This my request for delete a control-service,
request "/controller-services/{id}" (id is, The controller service id.)
curl -X DELETE \
http://localhost:8090/nifi-api/controller-services/015b1030-a099-13d3-812c-77772afcaeb0 \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
and the response is "The revision must be specified."
status : "400 Bad Request"
Any idea please?
I finally got some answers about my mistake after reading this article
It seems you have to add two information to request url; version and clientId.
After make a call and get a component form nifi instance, it sends a version number inside a DTO to you as explained here
like this:
and finally i made a call like below and it worked:
curl -X DELETE \
'http://localhost:8090/nifi-api/controller-services/015b1030-a099-13d3-812c-77772afcaeb0?version=0&clientId=5ed15669-015d-1000-99cf-bc9c6f378085' \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \

Use CloudHub API to restart an application via REST call

At the moment, in order to restart a Mule application, I need to:
Log into Mule via a browser
Navigate to the Runtime Manager
Select my environment
Locate my application
Navigate to Settings
Then restart
I know that MuleSoft have a Management API (CloudHub API), but I cannot find an example of how to restart an application via a REST call.
If anyone has a working example or can point me in the right direction I would appreciate it.
Thanks
Just in case if anyone wants to know how to restart a Mule application hosted on CloudHub via REST API.
Call this API
https://anypoint.mulesoft.com/cloudhub/api/applications/{domain}/status with payload "RESTART"
API Endpoint: /applications/{domain}/status
Method: POST
Example payload in request body:
{
"status": " 'RESTART' or 'stop' or 'start' ",
"staticIpAddress": "10.4.6.22"
}
Postman code snippet: update the bearer token, domain and environment id
curl --request POST \
--url https://anypoint.mulesoft.com/cloudhub/api/applications/{cloudhub-app-
domain}/status \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--header 'Postman-Token: 42539dcd-1d33-4b66-80d9-6cfcc4ed8f77' \
--header 'X-ANYPNT-ENV-ID: environment ID' \
--header 'cache-control: no-cache' \
--data '{\n "status":"RESTART"\n}'
First, you need to install the runtime manager agent
https://docs.mulesoft.com/runtime-manager/installing-and-configuring-runtime-manager-agent
Second, you can find an example in below link:
https://docs.mulesoft.com/runtime-manager/managing-applications-and-domains
Operation: Restart an Application
PUT http://localhost:9999/mule/applications/myapp/restart HTTP/1.1
Content-Type: application/json
Further to developer9's answer, here's how to obtain the Bearer token:
https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/f1e97bc6-315a-4490-82a7-23abe036327a.anypoint-platform/access-management-api/version/v1/pages/Authentication/
To access Platform APIs, you must obtain a token from either the login
endpoint or using the OAuth authorization process.
To authenticate using a username and password, you must invoke the /login API.
POST /accounts/login HTTP/1.1
Content-Type: application/json
{
"username" : "joe",
"password" : "password"
}
This returns the following response and token:
{
"access_token": "d127e2ec-a703-4e2a-8629-e9158804748b",
"token_type": "bearer"
}
You can then use that in the restart (or other API request). Eg (note, update the bearer token, domain and environment id)
curl --request POST \
--url https://anypoint.mulesoft.com/cloudhub/api/applications/{cloudhub-app-
domain}/status \
--header 'Authorization: Bearer d127e2ec-a703-4e2a-8629-e9158804748b' \
--header 'Content-Type: application/json' \
--header 'Postman-Token: 42539dcd-1d33-4b66-80d9-6cfcc4ed8f77' \
--header 'X-ANYPNT-ENV-ID: environment ID' \
--header 'cache-control: no-cache' \
--data '{\n "status":"RESTART"\n}'

Trigger Rundeck Job via API

Rundeck supports triggering jobs via their API. The API documentation is available under documentation.
We are using API version 13 which does not yet support application/json. Therefore i need to use the XML based request.
In my previous attempts, i always get the response:
<result error="true" apiversion="13">
<error code="api.error.job.options-invalid">
<message>Job options were not valid: Option 'container' is required. Option 'version' is required.
</message>
</error>
</result>
Since there is no example request provided, i am searching for an example payload to trigger the job.
As seen in the response i have to provide the parameters "container" and "version" since they are required.
My most recent request payload was:
<executeJob>
<argString>-container containerName -version 1234567</argString>
</executeJob>
I also tried different variations of this payload, every time with the same response.
This should help you, assuming you have a token to access Rundeck with authorization to run the job
curl -D - -X "POST" -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Rundeck-Auth-Token: <TOKEN>" \
-d '{"argString":"-arg1 val1 -arg2 val2"}' \
http://<URL>/api/16/job/<JOB_ID>/executions