Bonita bmp 7 : bind JSON data to table - json

I'm a new in Bonita bpm. I receive data from my connector in the form as a json string.
There is like connector output param. I store this param like pool variable.
Then, i get this value with external api:
../API/bpm/activityVariable/{{taskId}}/response_rows[enter image description here][1]
I got json array like :
[{"reason":"reason","createdBy":"4","endDate":"2018-11-23T00:00:00+0000","persistenceId":"1","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-15T00:00:00+0000","createtionDate":"2018-11-21T05:56:02+0000"},{"reason":"reason","createdBy":"4","endDate":"2018-11-23T00:00:00+0000","persistenceId":"2","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-16T00:00:00+0000","createtionDate":"2018-11-21T06:01:26+0000"},{"reason":"test","createdBy":"4","endDate":"2018-11-16T00:00:00+0000","persistenceId":"3","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-16T00:00:00+0000","createtionDate":"2018-11-21T07:26:57+0000"},{"reason":"reason","createdBy":"4","endDate":"2018-11-23T00:00:00+0000","persistenceId":"33","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-22T00:00:00+0000","createtionDate":"2018-11-21T13:25:35+0000"},{"reason":"1111","createdBy":"4","endDate":"2018-11-17T00:00:00+0000","persistenceId":"34","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-17T00:00:00+0000","createtionDate":"2018-11-21T13:26:58+0000"},{"reason":"rrr","createdBy":"4","endDate":"2018-11-30T00:00:00+0000","persistenceId":"35","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-09T00:00:00+0000","createtionDate":"2018-11-21T13:29:37+0000"}]
I can create json variable from this json and set it as a data source.
I see that everything works fine. But when I set the data as External API variable nothing is displayed in the table.
I use the expression of my variable and not a constant (a small button in the content setting).
How can I show json array as a table ? Is it posiible ?

You can alternately save the API URL as a String Variable
return '../API/bpm/activityVariable/' + $data.taskId + '/response_rows[enter image description here][1]';
and use it as URL expression or variable.

Related

I am trying to get a dynamic value from the response data and use that dynamic value to pass in the url path so the next get method can use it

I am new to jmeter
The response data is
I want to take contentId from the above response and pass it at the end of other get url path so as to get data which is under that content id and I have to use it for multiple users who have different contentId. So how could I dynamically pass it?
Add JSON Extractor as a child of the request which returns the above response and configure it as follows:
name of created variables: anything meaningful, i.e. contentId
JSON Path Expressions: $.contentId
That's it, in the next request path field just use ${contentId} variable where required:
More information:
JSONPath - Getting Started
API Testing With JMeter and the JSON Extractor
Functions and Variables

Save api json to database using laravel

Is it possible to get data from an api url and save it directly to database when working with laravel? the data i get from the url is of the format {"name":"100KVA SUKAM Generator","level":"5.965"}.
Yes, you can create table with json type field (or text) and keep data there:
$table->json('data_from_api');
https://laravel.com/docs/5.2/migrations#writing-migrations
If you want to persist data as usual data, you can use mass assignment. First, convert JSON to an array with [json_decode][1] and save data like that:
$data = json_decode($jsonData, true)
Model::create($data);
Don't forget to add all columns to a $fillable property of a model.

Adding query Parameters to Go Json Rest

I am using the library go-json-rest. I'm trying to recognize queries parameters in the code for example localhost:8080/reminders?hello=world I want to access {hello: world} . I have the following code:
//in another function
&rest.Route{"GET", "/reminders", i.GetAllReminders},
func (i *Impl) GetAllReminders(w rest.ResponseWriter, r *rest.Request) {
reminders := []Reminder{}
i.DB.Find(&reminders)
w.WriteJson(&reminders)
}
I know that r.PathParams holds the url parameters but I cannot seem to find how to the query parameters past the "?" in the url.
Given that go-json-rest is a thin wrapper on top of net/http, have you looked at that package's documentation? Specifically, the Request object has a field Form that contains a parsed map of query string values as well as POST data, that you can access as a url.Values (map[string][]string), or retrieve one in particular from FormValue.

In Talend, how do you keep input values provided to tSoap so that you can use them with the Soap response?

I have a Talend Job that currently does the following:
Input CSV --Main--> tMap --Output--> tSoap --Main--> Output CSV
The input CSV has
ID and TYPE as input columns.
The Map creates a Soap XML (String) message using the ID from the CSV and passes that String to the tSoap component.
The tSoap component fires the web request, which sends the response to the next component. That data is then written to CSV.
The problem is that TYPE from the input CSV is not passed through to amalgamate with the SOAP response data. Only the response data seems accessible.
I've had a look at tBufferInput / tBufferOutput and tFlowToIterate but they seem to work in scenarios where the tSoap component does not depend on an input from the main flow.
Does anyone know which components can be used to achieve the amalgamation?
Thank you
If you output the data you need to reuse to a tHashOutput component you should be able to rejoin your data with the response output from tSoap assuming there's some natural join element from the response.
I solved this in the end by:
Placing between the output from the tMap and the input to the tSoap, a new component - tSetGlobalVar
Inside tSetGlobalVar, you can then create a new row, which maps an input column (Value) to a named variable that you specify as the 'Key'.
E.g. Key = "ID", Value = row11.ID
The output from tSetGlobalVar then goes into the tSoap component.
The output from tSoap goes into a new tMap.
Inside this new tMap is the Body column from the previous tSoap component which maps to an output column. To access the stored "ID" variable for the current flow/iteration, I created a new output column, and instead of mapping any columns from the inputs, used (String)globalMap.get("ID"); which would insert the value back into the flow.

How to get values in this json object in ext js?

I try to get values and put in a textfield. return json is ;
Object { info=[1]}
in this
info[Object { name="name", another ="another"}]
clearly ;
{"info":[{"name":"name","another":"another"}]}
i do ;
var resp = Ext.decode(response.responseText);
txtName.setValue(resp.info);
and in text field it shown [Object object]
How to i get name and another values?
Because response.info is a root level node in your response which contains an array of objects:
[{"name":"name","another":"another"}]
So to use a value from this object in the text box (as it needs a string value) you need to access the object in this array and then extract the value from whichever key you want so to get the name value in the text field you would use:
txtName.setValue(resp.info[0].name);
As a side note, usually you would use an ExtJS Store with a proxy configured to retrieve and store data from the server (if returned in this type of JSON like structure). On the store config you would configure the root property to the tell the store reader which named property in the response contains the data. So in this case 'info' is the root where your data can then be found. The store reader would then loop through the objects in the array and create records for each in the store for the rest of the application to use.