Unable to update "consent status" in apache unomi - gdprconsentform

I am having trouble in updating the consent status in Apache Unomi through
http://localhost:8181/cxs/profiles endpoint.
However, I am able to create new consents at the time of profile creation or update.
The request payload for profile creation is as follows:
curl -X POST \
http://localhost:8181/cxs/profiles \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Basic a2FyYWY6a2FyYWY=' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Length: 497' \
-H 'Content-Type: application/json' \
-H 'Cookie: e61854e4f21d7dd7f978ad1a3b9ad7b8=a798094d250c6887bf5d0acdf641809a; context-profile-id=7ba87dc1-b39c-481c-8c9a-5238881992ce' \
-H 'Host: localhost:8181' \
-H 'Postman-Token: e3fc0ce5-2e88-480f-8310-7cf309563adb,a4c96158-804d-4b32-bd4e-2ed905b5cd5e' \
-H 'User-Agent: PostmanRuntime/7.20.1' \
-H 'cache-control: no-cache' \
-d '{
"itemId":"2411426b-fdb5-428d-8f3f-753267bb2c62",
"itemType":"profile",
"consents":{
"postal/newsletter": {
"scope": "postal",
"typeIdentifier": "newsletter",
"status": "GRANTED",
"statusDate": "2019-07-28T04:46:38Z",
"revokeDate": "2023-07-28T04:46:38Z"
}
},
"properties":{
"country":"QA",
"firstname":"Basheer",
"leadAssignedTo":"XXXXXX",
"gender":"M",
"status":1
}
}'
This will return a response as follows :
{
"itemId": "2411426b-fdb5-428d-8f3f-753267bb2c62",
"itemType": "profile",
"version": null,
"properties": {
"country": "QA",
"firstname": "Basheer",
"leadAssignedTo": "XXXXXX",
"gender": "M",
"status": 1
},
"systemProperties": {},
"segments": [
"leads"
],
"scores": {},
"mergedWith": null,
"consents": {
"postal/newsletter": {
"scope": "postal",
"typeIdentifier": "newsletter",
"status": "GRANTED",
"statusDate": "2019-07-28T04:46:38Z",
"revokeDate": "2023-07-28T04:46:38Z"
}
}
}
However, If I try to update the profile and consent using the same endpoint :
curl -X POST \
http://localhost:8181/cxs/profiles \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Basic a2FyYWY6a2FyYWY=' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Length: 502' \
-H 'Content-Type: application/json' \
-H 'Cookie: e61854e4f21d7dd7f978ad1a3b9ad7b8=a798094d250c6887bf5d0acdf641809a; context-profile-id=7ba87dc1-b39c-481c-8c9a-5238881992ce' \
-H 'Host: localhost:8181' \
-H 'Postman-Token: 72d712cf-1a53-44a9-aa77-139fb7418509,7054cbf2-e1cb-4bde-9f04-314beb0f4a9f' \
-H 'User-Agent: PostmanRuntime/7.20.1' \
-H 'cache-control: no-cache' \
-d '{
"itemId":"2411426b-fdb5-428d-8f3f-753267bb2c62",
"itemType":"profile",
"consents":{
"postal/newsletter": {
"scope": "postal",
"typeIdentifier": "newsletter",
"status": "REVOKED",
"statusDate": "2019-07-28T04:46:38Z",
"revokeDate": "2019-10-28T04:46:38Z"
}
},
"properties":{
"country":"QA",
"firstname":"Basheer12345",
"leadAssignedTo":"XXXXXX",
"gender":"M",
"status":1
}
}'
The response is as follows :
{
"itemId": "2411426b-fdb5-428d-8f3f-753267bb2c62",
"itemType": "profile",
"version": 2,
"properties": {
"country": "QA",
"firstname": "Basheer12345",
"leadAssignedTo": "XXXXXX",
"gender": "M",
"status": 1
},
"systemProperties": {},
"segments": [
"leads"
],
"scores": {},
"mergedWith": null,
"consents": {
"postal/newsletter": {
"scope": "postal",
"typeIdentifier": "newsletter",
"status": "GRANTED",
"statusDate": "2019-07-28T04:46:38Z",
"revokeDate": "2019-10-28T04:46:38Z"
}
}
}
Here the firstname, revokeDate has been updated, but the status is not updated. What am I doing wrong?
Why the status is not geting updated?

It was a UNOMI bug. We have fixed the issue and expecting it to be solved in the newer versions.
UNOMI-261

Related

Shopware Store API Search ( INCLUDE | FILTER)

I want to compress the Data of the Shopware Storefront Search API. At the Moment I get about 50.000 Lines of API
How can I compress the Data and just get the JSON Fields I need?
For my App I need only the Fields
Product Number
Product Name
Product Price
Product Description
manufacturer Name
URL
$json->elements[$i]->productNumber;
$json->elements[$i]->name;
$json->elements[$i]->calculatedPrice->totalPrice;
$json->elements[$i]->description;
$json->elements[$i]->manufacturer->name;
$json->elements[$i]->cover->media->thumbnails[3]->url;
$json->elements[$i]->seoUrls[0]->seoPathInfo;
My API Call:
curl --location --request POST 'https://my-url.com/store-api/search?search=sofa&limit=4' \
--header 'sw-access-key: ***Shopware-Key***' \
--header 'Accept: application/json' \
--header 'sw-include-seo-urls: true' \
--header 'Content-Type: application/json' \
--header 'Cookie: _GRECAPTCHA=1' \
I tryed to insert a API Body
like the Example Code but gets ignored.
--data '{
"page": 1,
"limit": 1,
"filter": [
{
"type": "string",
"field": "string",
"value": "string"
}
],
"sort": [
{
"field": "string",
"order": "string",
"naturalSorting": true
}
],
"post-filter": [
{
"type": "string",
"field": "string",
"value": "string"
}
],
"associations": {},
"aggregations": [
{
"name": "string",
"type": "string",
"field": "string"
}
],
"grouping": [
"string"
],
"order": "string",
"p": 1,
"manufacturer": "string",
"min-price": 0,
"max-price": 0,
"rating": 0,
"shipping-free": false,
"properties": "string",
"manufacturer-filter": true,
"price-filter": true,
"rating-filter": true,
"shipping-free-filter": true,
"property-filter": true,
"property-whitelist": "string",
"reduce-aggregations": "string",
"no-aggregations": "string",
"only-aggregations": "string",
"search": "string"
}'
I do suggest using some kind of tool to compose your queries. Something like Postman will work. After you are done playing, you can export the working query from Postman to CURL as well.
I believe you are looking for the includes filter. Here is a documentation URL for the full article.
I played around a little, but could not filter out sub-queries per your request. I bet it is possible, but you'll have to play around with it yourself as it will require some time :)
curl --location --request POST 'http://website.com/store-api/product' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'sw-access-key: XXXX' \
--data-raw '{
"limit": 1,
"includes": {
"product": ["name", "productNumber", "calculatedPrice", "manufacturer", "cover", "description", "seoUrls"]
},
"associations": {
"manufacturer": {},
"seoUrls": {}
}
}'

How to get Execution details through API Calls in Rundeck

I am trying to create a dashboard, for which i am getting all the details using API in Rundeck
and then want to write the data in Csv File,
here is an example trying to fetch data for weekly basis, which is not working [ error msg: {"error":true,"apiversion":35,"errorCode":"api.error.invalid.request","message":"Invalid API Request: /api/35/executions/1w"}],kindly let me know what am i doing wrong to fetch details on weekly, monthly and daily basis
format
#!/bin/sh
protocol="http"
rdeck_host="machinexyz.local"
rdeck_port="4440"
rdeck_api="35"
rdeck_token="token"
rdeck_project="projectRun"
xy="1w"
curl -s --location --request GET "$protocol://$rdeck_host:$rdeck_port/api/$rdeck_api/project/$rdeck_project/$xy" \
--header "Accept: application/json" \
--header "X-Rundeck-Auth-Token: $rdeck_token
Thanks
Following the documentation you could use the recentFilter parameter on your API call, I did an example (at the end I added the jq command to "beautify" the default output):
#!/bin/sh
# protocol
protocol="http"
# basic rundeck info
rdeck_host="localhost"
rdeck_port="4440"
rdeck_api="36"
rdeck_token="ni28E9M5s5H0s3kyCKQ0tbfPCI8jNZS1"
# specific api call info
rdeck_project="ProjectEXAMPLE"
time="1h"
# api call
curl -s --location --request GET "$protocol://$rdeck_host:$rdeck_port/api/$rdeck_api/project/$rdeck_project/executions?recentFilter=$time" \
--header "Accept: application/json" \
--header "X-Rundeck-Auth-Token: $rdeck_token" \
--header "Content-Type: application/json" | jq
Output:
{
"paging": {
"count": 2,
"total": 2,
"offset": 0,
"max": 20
},
"executions": [
{
"id": 2,
"href": "http://localhost:4440/api/36/execution/2",
"permalink": "http://localhost:4440/project/ProjectEXAMPLE/execution/show/2",
"status": "succeeded",
"project": "ProjectEXAMPLE",
"executionType": "scheduled",
"user": "admin",
"date-started": {
"unixtime": 1608296400032,
"date": "2020-12-18T13:00:00Z"
},
"date-ended": {
"unixtime": 1608296400374,
"date": "2020-12-18T13:00:00Z"
},
"job": {
"id": "f2a837d2-1a9c-4387-89d7-0243bbfe6ba9",
"averageDuration": 590,
"name": "HelloWorld",
"group": "",
"project": "ProjectEXAMPLE",
"description": "",
"href": "http://localhost:4440/api/36/job/f2a837d2-1a9c-4387-89d7-0243bbfe6ba9",
"permalink": "http://localhost:4440/project/ProjectEXAMPLE/job/show/f2a837d2-1a9c-4387-89d7-0243bbfe6ba9"
},
"description": "echo \"hi\"",
"argstring": null,
"serverUUID": "94ac86b1-56e9-4bc3-9a4c-50cd7c8a5b59",
"successfulNodes": [
"localhost"
]
},
{
"id": 1,
"href": "http://localhost:4440/api/36/execution/1",
"permalink": "http://localhost:4440/project/ProjectEXAMPLE/execution/show/1",
"status": "succeeded",
"project": "ProjectEXAMPLE",
"executionType": "scheduled",
"user": "admin",
"date-started": {
"unixtime": 1608295800075,
"date": "2020-12-18T12:50:00Z"
},
"date-ended": {
"unixtime": 1608295800914,
"date": "2020-12-18T12:50:00Z"
},
"job": {
"id": "f2a837d2-1a9c-4387-89d7-0243bbfe6ba9",
"averageDuration": 590,
"name": "HelloWorld",
"group": "",
"project": "ProjectEXAMPLE",
"description": "",
"href": "http://localhost:4440/api/36/job/f2a837d2-1a9c-4387-89d7-0243bbfe6ba9",
"permalink": "http://localhost:4440/project/ProjectEXAMPLE/job/show/f2a837d2-1a9c-4387-89d7-0243bbfe6ba9"
},
"description": "echo \"hi\"",
"argstring": null,
"serverUUID": "94ac86b1-56e9-4bc3-9a4c-50cd7c8a5b59",
"successfulNodes": [
"localhost"
]
}
]
}

How do I set the query location when using bigQuery.jobs.insert API

I'm using bigQuery.jobs.insert API and I need to set the location of the query
In bigQuery.jobs.query API I see I can set the location as follow
curl --request POST \
'https://www.googleapis.com/bigquery/v2/projects/[PROJECTID]/queries' \
--header 'Authorization: Bearer [YOUR_BEARER_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"query":"select 5","location":"asia-northeast1"}' \
--compressed
But in bigQuery.jobs.insert I see no such option, I tried this:
"resource": {
"projectId": "project",
"configuration": {
"query": {
"query": "SELECT 5",
"useLegacySql": false,
"location": "asia-northeast1",
"defaultDataset": {
"datasetId": "ds"
},
"jobReference": {
"location": "asia-northeast1"
}
}
}
}
Read https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs
and https://cloud.google.com/bigquery/docs/locations#specifying_your_location
When you use the API, specify your region in the location property in the jobReference section of the job resource.

curl send JSON payload

I'm just strating with RabbitMQ and I try to send a json payload to it. Unfortunately I'm getting error:
{"error":"bad_request","reason":"payload_not_string"}
I read somewhere that I need to use "content_type": "application/json" but that has not helped either.
This is the body I'm trying to send:
{
"properties": {
"delivery_mode": 2,
"content_type": "application/json"
},
"routing_key": "git",
"payload": {
"action": "created",
"comment": {
"url": "https://api.github.com/repos/baxterthehacker/public-repo/comments/11056394",
"id": 11056394
}
},
"payload_encoding": "string"
}
And the full curl:
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Basic Z3Vlc3Q6Z3Vlc3Q=" \
-d \
'{
"properties": {
"delivery_mode": 2,
"content_type": "application/json"
},
"routing_key": "git",
"payload": {
"action": "created",
"comment": {
"url": "https://api.github.com/repos/baxterthehacker/public-repo/comments/11056394",
"id": 11056394
}
},
"payload_encoding": "string"
}' \
'http://localhost:8090/api/exchanges/%2f/amq.topic/publish'
Is it possible to send the json payload at all? I was thinking of sending Github webhooks to one of the queues.
The RabbitMQ team monitors this mailing list and only sometimes answers questions on StackOverflow.
The error you see is correct, your payload is not a string. I had to reproduce this and re-visit the HTTP API docs for this to become clear.
The value you are passing to the payload key in your JSON is more JSON - in order for it to be a string, you must escape it correctly and pass it like this:
$ curl -4vvv -u guest:guest -H 'Content-Type: application/json' localhost:15672/api/exchanges/%2f/amq.topic/publish --data-binary '{
"properties": {
"delivery_mode": 2,
"content_type": "application/json"
},
"routing_key": "git",
"payload":"{\"action\":\"created\",\"comment\":{\"url\":\"https://api.github.com/repos/baxterthehacker/public-repo/comments/11056394\",\"id\":11056394}}",
"payload_encoding": "string"
}'
The other alternative is to base-64 encode the JSON from GitHub and pass that as the payload - you won't have to escape anything if you do that.

CURL command to create UserStory in rally in a specific Feature throwing following errors

curl -X POST \
https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement/create \
-H 'cache-control: no-cache' \
-H 'postman-token: XXXXXXX' \
-H 'zsessionid: XXXXXXX' \
-d '{
"hierarchialrequirement": {
"Name": "Test US",
"Project": "project/XXXXXX",
"Description": "Test US" ,
"PortfolioItem" : {
"_ref" : "portfolioitem/feature/XXXXX" ,
"_type" : "PortfolioItem/Feature"
}
}
}'
Response :
{
"CreateResult": {
"_rallyAPIMajor": "2",
"_rallyAPIMinor": "0",
"Errors": [
"Could not read: Could not read referenced object portfolioitem/feature/XXXXXXXX"
],
"Warnings": []
}
}
i have tried multiple combos of PortfolioItem like
curl -X POST \
https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement/create \
-H 'cache-control: no-cache' \
-H 'postman-token: XXXXX' \
-H 'zsessionid: XXXXX' \
-d '{
"hierarchialrequirement": {
"Name": "Test US",
"Project": "project/XXXXXX",
"Description": "TES US" ,
"PortfolioItem" : "portfolioitem/feature/XXXXXX"
}
}'
Response :
{
"CreateResult": {
"_rallyAPIMajor": "2",
"_rallyAPIMinor": "0",
"Errors": [
"Could not read: Could not read referenced object null"
],
"Warnings": []
}
}
i can create US but i just want to add parent feature to it while creating it .
I think you're just missing a leading / on your portfolioitem ref.
"PortfolioItem": "/portfolioitem/feature/12345"
Let me know if that doesn't work!
i was able to fix it by adding the following ref flags
"PortfolioItem": {
"_ref": "portfolioitem/feature/XXXXX",
"_type": "PortfolioItem/Feature"
}
it worked for me now