Camunda with variables in return - json

Please help me. I have a Camunda process. I call this process using Camunda rest-engine with the endpoint “http://localhost:8080/engine-rest/process-definition/key/CRE_P_CashCredit_Scoring_ID_01/start”.
My Request: { “variables”: { “ApplySource”: { “value”: “branch”, “type”: “string” }, “CredSum”: { “value”: 2000, “type”: “Double” } }, “businessKey”: “Test”, “withVariablesInReturn”: “true” }
I want that request variables don’t return me. Only the process variables in Response variables.
Process variables: StopFactor, StopFactorReason, FinalOfferAmount

Related

Design Automation LogTrace onProgress cannot match arguments in custom call

I am trying to export a .sat file to one in .stp format. I've had trouble doing the export directly to a bucket (from .ipt to .stp no problem but it doesn't work from .sat to .stp).
Finally, I have tried using LogTrace with custom data to send the file data through a string (step format has string content and it's created correctly). Unfortunately, I can't make work the callback !ACESAPI:acesHttpOperation with the custom data (it does work by default).
This is my workitem call
{
"activityId": "DNhofWmrTzDm5Cdj3ISk0yvVA0IOBEja.InventorActivity16+3",
"arguments": {
"InventorDoc": {
"url": "https://developer.api.autodesk.com/oss/v2/signedresources/xxxxxxxx-aa45-43fa-8c0e-e594a3f671cc?region=US"
},
"InventorParams": {
"url": "data:application/json,{\"height\":\"16 in\", \"width\":\"10 in\"}"
},
"onProgress": {
"verb": "post",
"url": "https://xxxxxxx"
}
}
And this is a part of the log response
I think there is a problem with the API call from !ACESAPI:acesHttpOperation.
I follow same instructions from
callback documentation
Thanks in advance

How to determine why an Azure Function App is not triggered by a webhook

I have:
An JavaScript Azure Function in an HTTP webhook configuration; the Function provides a URL; the Function performs an action
A webhook configured in the software I hope to receive notifications from
An Azure Logic App with an HTTP/webhook step that provides a URL for the webhook notification to go to
My goal is that the Azure Function's URL receives notifications from the software's webhook and performs an action. The Azure Logic App is for testing only.
What works
When the the Azure Logic App's URL is used in the software's webhook configuration, the desired action is performed. All works as expected.
The Azure Logic App's logging shows the JSON output from the incoming webhook. I expect (but believe this may be where I am going wrong) that this is the JSON the webhook is sending to the Azure Logic App's URL. When this JSON is used in the Azure Function UI's "Test" tab > "Request body" field, the desired action is performed. All works as expected.
When the Azure Function's URL and the JSON is in a Postman request, the desired action is performed. All works as expected.
What doesn't work
When the Azure Function's URL is used in the software's webhook configuration, no action is performed. This is of course my goal. From everything I have read, I understand that this URL as a webhook endpoint should work.
Azure Function's URL
This is from Get function URL > default (Function key).
https://<app_name>.azurewebsites.net/api/content?code=<api_key>
Other Azure Function config settings
Allowed HTTP methods: GET, POST
Authorization level: Function
The JSON I believe to be coming over the webhook
{
"headers": {
"Expect": "100-continue",
"Host": "redacted",
"X-Telligent-Webhook-Sender": "redacted",
"Content-Length": "16908",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
}
I also tried with the following test code for the same results. It aligns more closely with the sample payload data provided by the software company:
What I tried
{
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
Sample payload data
{
"events": [
{
"TypeId": "407ad3bc-8269-493e-ac56-9127656527df",
"DateOccurred": "2015-12-04T16:31:55.5383926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
},
{
"TypeId": "3b75c5b9-4705-4a97-93f5-a4941dc69bc9",
"DateOccurred": "2015-12-04T16:48:03.7343926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
}
]
}
I do not know how to determine why the Azure Function is not triggered by the webhook. The software's API documentation does not seem to provide a way to look at the JSON being sent over the webhook, although in my inexperience I may be wrong.
Is there a mechanism within Azure, or Postman, or another tool that lets me see what JSON is being sent over the webhook? Or perhaps is there another approach to determining the cause of the issue?
Thank you for any help.
This is how I got the JSON file from Azure alerts.
Install Ruby on the server
Install Sinatra with following command gem install sinatra
Create file webhook.rb and paste code bellow
require 'sinatra'
set :port, 80
set :bind, '0.0.0.0'
post '/event' do
status 204 #successful request with no body content
request.body.rewind
request_payload = JSON.parse(request.body.read)
#append the payload to a file
File.open("events.txt", "a") do |f|
f.puts(request_payload)
end
end
Run the web service with command ruby webhook.rb
JSON fill be written to file events.txt

Angular Http get method difference between getById and getByName

I am learning the basics of Angular and am currently working on making a REST service using the HttpClient from #angular/common/http.
In many tutorials the first step is making a http.get() call. Usually first the whole list following a http.get() call focused on retrieving only one element. In my example, I have a userList (with users). I have made two methods: getUserById() and getUserByName(). ${this.userUrl} refers to the location of the database (using a JSON file) Below they are displayed:
constructor(private http: HttpClient) {
}
getUserById(id: number): Observable<IUser> {
return this.http.get<IUser>(`${this.userUrl}/${id}`);
}
getUserByName(name: string): Observable<IUser> {
return this.http.get<IUser>(`${this.userUrl}/?name=${name}`);
}
Initially I tried to make the getUserByName() method work via the same way the getUserById(). Thus using:
getUserByName(name: string): Observable<IUser> {
return this.http.get<IUser>(`${this.userUrl}/${name}`);
}
This didn't work and I received the error statement 404 file not found. This is the json file that I worked with (I have set up a json server so that I could also perform http.delete() methods and so on):
{"users": [
{
"id": 1,
"name": "James",
"lastName": "Jameson",
"dateOfBirth": "10-10-2000",
"occupation": "Student"
},
{
"id": 3,
"name": "Steven",
"lastName": "Stevenson",
"dateOfBirth": "10-10-1990",
"occupation": "Police officer"
}]}
Can anyone explain me why the getUserById methods works using just '/${id}' in the url call and why the getUserByName needs to use '?/name=${name}'?
if you use:
getUserById(id: number): Observable<IUser> {
return this.http.get<IUser>(`${this.userUrl}/${id}`);
}
getUserByName(name: string): Observable<IUser> {
return this.http.get<IUser>(`${this.userUrl}/${name}`);
}
and call for exemple /user3262578, it will enter to the first endpoint method which is getUserById(id), you're clearly have ambiguity here. the both methode have the same endpoints.
try to change the second endpoint (getUserByName) to other link like:
return this.http.get<IUser>(`${this.userUrl}/search/${name}`);
This is nothing to do with Angular, this is purely a backend endpoint issue.
Test requests to your backend using an HTTP Rest Client such as PostMan.
Once everything is working at the backend as expected, then integrate with Angular.

How to solve "error executing aggreation pipeline: variable 'XYZ' not bound" in MongoDB aggregation?

I am using Restheart and MongoDB and also new in these, I have to write aggregation in MongoDb. I written aggregation in mongoDb with $match.
Here Sample Code:
{
"aggrs": [{
"type": "pipeline",
"uri": "aggregation_by_time",
"stages": [{
"_$match": {
"bus::destination": {
"_$in": {
"_$var": "stand"
}
},
"bus::eta": {
"_$gte": {
"_$var": "fromDate"
},
"_$lte": {
"_$var": "toDate"
}
},
"tickets": {
"_$eq": {
"_$var": "isConfirmedTravel"
}
}
}
}]
}]
}
Here Sample Access Url:
http://..xyz../_aggrs/aggregation_by_time?avars={"stand":["A","B","C","D","E","F"]}
When I access this url then it is not working, displaying some error.
Error:
{"http status code":400,"http status description":"Bad
Request","message":"error executing aggreation pipeline: variable
isConfirmedTravel not bound"}
When I access below url Then it will work.
http://..xyz../_aggrs/aggregation_by_time?avars={"stand":["A","B","C","D","E","F"],"isConfirmedTravel":"true"}
So I want to make optional $match, Like if I don't mention as a parmater "isConfirmedTravel" in url, then it should work. And If I want to send as parameter "isConfirmedTravel" in url then It should also work. But In my case If put field in $match then you should have to mention in url. Thats why I want to set optional "isConfirmedTravel":"true" field. If I call then it should work and if I will not call then url should be work.

Kinesis to Lambda - Parsing Data

I'm following this tutorial to push data from my API Gateway to a Kinesis stream :
http://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-kinesis.html#api-gateway-get-and-add-records-to-stream
I have my Body Mapping Template setup as.....
{
"StreamName": "my-stream-name",
"Data": "$util.base64Encode($input.path('$.Data'))",
"PartitionKey": "$input.path('$.PartitionKey')"
}
...and have put the following in the Request Body of an API test...
{
"Data": {
"Foo": "A",
"Bar": "B"
},
"PartitionKey": "some key"
}
I've then created a Lambda Function which has a trigger set up against the same Kinesis Stream. However, I'm struggling to decode/deserialise the records coming in from Kinesis.
exports.handler = (event, context, callback) => {
event.Records.forEach(function(record) {
let payload = JSON.parse(Buffer(record.kinesis.data, 'base64').toString('ascii'))
});
};
It seems that the data is being serialised to Kinesis in a non-JSON format. The value for record.kinesis.data in the forEach loop is
e0Zvbz1BLCBCYXI9Qn0=
...which when push through Buffer(record.kinesis.data, 'base64').toString('ascii')
returns as
{Foo=A, Bar=B}
not
{"Foo":"A", "Bar":"B"}
Main aim is obviously to get payload to in a state where I can say console.log(payload.Foo)
Any hints as to what I should be doing/looking for would be appreciated.
For anyone else out there
I had my Body Mapping Template setup as.....
{
"StreamName": "my-stream-name",
"Data": "$util.base64Encode($input.path('$.Data'))",
"PartitionKey": "$input.path('$.PartitionKey')"
}
Now changed to handle the json....
{
"StreamName": "my-stream-name",
"Data": "$util.base64Encode($input.json('$.Data'))",
"PartitionKey": "$input.path('$.PartitionKey')"
}
where...
($input.json('$.Data'))
is the change :)