Generic Jolt Spec for Multiple Input JSON - Multiple Inputs - json

I m having difficulty in writing a jolt spec for different JSON inputs. I need to get a generic jolt spec so that i get a flattened json.
Input 1 : We have a materialMovements array
{
"id": "xxxxx",
},
"status": {
"deliveryComplete": "xxxxx",
],
"overallStatusDetail": "xxxxx",
"overallStatus": "xxxxx"
},
"quantity": {
"target": {
"amount": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
}
},
"dates": {
"plannedFinishDate": "xxxxx",
"plannedStartDate": "xxxxx",
"actualFinishDate": "xxxxx"
},
"consumptionFlag": xxxxx,
"billOfMaterials": "xxxxx",
"deletionIndicator": "",
"routingNumber": "xxxxx",
"mainWorkCenter": "xxxxx",
"orderRecipe": "xxxxx",
"item": {
"number": "xxxxx",
"product": {
"id": "xxxxx",
"number": "xxxxx",
"description": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
},
"goodsReceipt": {
"amount": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
},
"storageLocation": {
"code": "xxxxx",
"description": "xxxxx"
}
},
"reservation": {
"id": "xxxxx",
"number": "xxxxx",
},
"materialMovements": [
{
"id": "xxxxx",
"number": "xxxxx",
"postingDate": "xxxxx",
"items": [
{
"number": "xxxxx",
},
"product": {
"id": "xxxxx",
}
}
]
}
}
],
"sourceSystem": "NA"
}
Input 2 : We dont have a materialmovements array
{
"id": "xxxxx",
},
"status": {
"deliveryComplete": "xxxxx",
],
"overallStatusDetail": "xxxxx",
"overallStatus": "xxxxx"
},
"quantity": {
"target": {
"amount": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
}
},
"dates": {
"plannedFinishDate": "xxxxx",
"plannedStartDate": "xxxxx",
"actualFinishDate": "xxxxx"
},
"consumptionFlag": xxxxx,
"billOfMaterials": "xxxxx",
"deletionIndicator": "",
"routingNumber": "xxxxx",
"mainWorkCenter": "xxxxx",
"orderRecipe": "xxxxx",
"item": {
"number": "xxxxx",
"product": {
"id": "xxxxx",
"number": "xxxxx",
"description": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
},
"goodsReceipt": {
"amount": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
},
"storageLocation": {
"code": "xxxxx",
"description": "xxxxx"
}
},
"reservation": {
"id": "xxxxx",
"number": "xxxxx",
},
"sourceSystem": "NA"
}
I hv used the joltspec for the Input 1 which is working fine, i need it to work for the input 2 also
[
{
"operation": "shift",
"spec": {
"materialMovements": {
"*": {
"#(2,sourceSystem)": "[&1].SourceSystem",
"#(2,number)": "[&1].ProcessOrderNumber",
"#(2,item.number)": "[&1].ProcessOrderLineNumber",
"#(2,item.product.number)": "[&1].MaterialToBeProduced",
"#(2,item.storageLocation.code)": "[&1].StorageLocation",
"#(2,item.goodsReceipt.amount)": "[&1].GoodsReceiptQuantity",
"#(2,locationIdentifier.id)": "[&1].Plant",
"#(2,billOfMaterials)": "[&1].BillOfMaterials",
"#(2,creationDate)": "[&1].CreationDate",
"#(2,dates.plannedFinishDate)": "[&1].PlannedFinishDate",
"#(2,dates.plannedStartDate)": "[&1].plannedStartDate",
"#(2,actualFinishDate)": "[&1].ActualFinishDate",
"#(2,deletionIndicator)": "[&1].DeletionIndicator",
"#(2,quantity.target.amount)": "[&1].OrderQuantity",
"#(2,quantity.target.baseUoM)": "[&1].UOM",
"#(2,quantity.confirmed.amount)": "[&1].ConfirmedQuantity",
"#(2,mainWorkCenter)": "[&1].MainWorkCenter",
"#(2,orderRecipe)": "[&1].OrderRecipe",
"#(2,Message Timestamp)": "[&1].LastModifiedOn",
"#(2,status.overallStatusDetail)": "[&1].StatusDetail",
"#(2,status.overallStatus)": "[&1].Status",
"postingDate": "[&1].ActualDeliveryDate"
}
}
}
}
]

The approach you are following is making it a little more complex :
I am not able to understand the Input Json as it is not proper but I guess this solution will help in resolving your issue :
Input :
{
"quantity": {
"target": {
"amount": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
}
},
"dates": {
"plannedFinishDate": "xxxxx",
"plannedStartDate": "xxxxx",
"actualFinishDate": "xxxxx"
},
"billOfMaterials": "xxxxx",
"deletionIndicator": "",
"routingNumber": "xxxxx",
"mainWorkCenter": "xxxxx",
"orderRecipe": "xxxxx",
"item": {
"number": "xxxxx",
"product": {
"id": "xxxxx",
"number": "xxxxx",
"description": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
},
"goodsReceipt": {
"amount": "xxxxx",
"baseUoM": "xxxxx",
"ISOBaseUoM": "xxxxx"
},
"storageLocation": {
"code": "xxxxx",
"description": "xxxxx"
}
},
"reservation": {
"id": "xxxxx",
"number": "xxxxx"
},
"materialMovements": [
{
"id": "xxxxx",
"number": "xxxxx",
"postingDate": "xxxxx",
"items": [
{
"number": "xxxxx"
},
{
"id": "xxxxx"
}
]
}
],
"sourceSystem": "NA"
}
Jolt Spec :
[
{
"operation": "shift",
"spec": {
"quantity": {
"target": {
"*": "[#4].&"
}
},
"dates": {
"*": "[#3].&"
},
"billOfMaterials": "[#2].&",
"deletionIndicator": "[#2].&",
"routingNumber": "[#2].&",
"mainWorkCenter": "[#2].&",
"orderRecipe": "[#2].&",
"materialMovements": {
"*": {
"id": "[&1].id",
"number": "[&1].number",
"items": {
"*": {
"number": "[&1].no"
}
}
}
}
}
},
//For Flattening Array to Single Json
{
"operation": "shift",
"spec": {
"*": {
"*": "&"
}
}
}
]

Related

Add new element to existing JSON Object with jq when transforming the JSON

I am trying to transform my JSON to a particular format, during that i have a usecase to add a feild which is in a different level of the JSON to a object.
Source JSON (Simplified)
{
"metadata": {
"ItemName": "Arun 101",
"fullflow": "true",
"name": "arunkumar",
"code": "12345"
},
"systemName": "Super Jack",
"priority": "Rush",
"materialFiles": [
{
"type": "packaging_metadata"
}
]
}
Query:
{metadata : .metadata+= {"operation":.materialFiles[0].type}, systemName }
Expected Output :
{
"metadata": {
"ItemName": "Arun 101",
"fullflow": "true",
"name": "arunkumar",
"code": "12345",
"operation": "packaging_metadata"
},
"systemName": "Super Jack",
"priority": "Rush"
}
https://jqplay.org/s/rEldNvbbANe
Use parentheses and don't update:
{metadata: (.metadata + {"operation":.materialFiles[0].type}), systemName, priority}
{
"metadata": {
"ItemName": "Arun 101",
"fullflow": "true",
"name": "arunkumar",
"code": "12345",
"operation": "packaging_metadata"
},
"systemName": "Super Jack",
"priority": "Rush"
}
Demo
Or just alter .metadata and delete .materialFiles:
.metadata+= {"operation":.materialFiles[0].type} | del(.materialFiles)
{
"metadata": {
"ItemName": "Arun 101",
"fullflow": "true",
"name": "arunkumar",
"code": "12345",
"operation": "packaging_metadata"
},
"systemName": "Super Jack",
"priority": "Rush"
}
Demo

Jolt Spec - Need help in getting Flattened Array

I am having some trouble with flattening the JSON. I have looked at examples and didn't get any closer as to what is mentioned above. I need to transform a JSON structure by using a JOLT spec. I use https://jolt-demo.appspot.com to test the following below.
JSON Input for a sample :
{
"metadata": {
"timestamp": "XXXXX"
},
"data": {
"product": {
"id": "XXXXX"
},
"storageLocations": [
{
"id": "XXXXX",
"stocks": [
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
},
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
},
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
}
],
"dateModified": "XXXXX"
},
{
"id": "XXXXX",
"stocks": [
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
},
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
},
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
}
],
"dateModified": "XXXXX"
},
{
"id": "XXXXX",
"stocks": [
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
},
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
},
{
"stockStatus": "XXXXX",
"quantity": [
{
"uom": "XXXXX",
"isoUom": "XXXXX",
"amount": "XXXXX"
}
]
}
],
"dateModified": "XXXXX"
}
],
"dateModified": "XXXXX",
"temporaryNegativeStock": "XXXXX"
}
}
the tried Jolt Spec is :
[
{
"operation": "shift",
"spec": {
"data": {
"storageLocations": {
"*": {
"#(3,metadata.timestamp)": "[&1].LastUpdated",
"#(2,product.id)": "[&1].MaterialCode",
"#(2,product.baseUoM)": "[&1].BaseUoM",
"#(2,product.isoBaseUom)": "[&1].ISOBaseUoM",
"#(2,location.id)": "[&1].LocationId",
"#(id)": "[&1].StorageLocationId",
"#(dateModified)": "[&1].StorageLocationLastUpdated",
"stocks": {
"*": {
"quantity": {
"*": {
"#(amount)": "[&5].StockAmount",
"#(isoUom)": "[&5].StockISOUoM",
"#(uom)": "[&5].StockUoM",
"#(2,stockStatus)": "[&5].StockStatus"
}
}
}
}
}
}
}
}
}
]
Ouput we are getting
[
{
"LastUpdated": "XXXXX",
"MaterialCode": "na-XXXXX",
"StorageLocationId": "XXXXX",
"StorageLocationLastUpdated": "XXXXX",
"StockAmount": [
"0.000",
"0.000",
"0.000"
],
"StockISOUoM": [
"XXXXX",
"XXXXX",
"XXXXX"
],
"StockUoM": [
"XXXXX",
"XXXXX",
"XXXXX"
],
"StockStatus": [
"XXXXX",
"XXXXX",
"XXXXX"
]
},
{
"LastUpdated": "XXXXX",
"MaterialCode": "na-XXXXX",
"StorageLocationId": "XXXXX",
"StorageLocationLastUpdated": "XXXXX",
"StockAmount": [
"0.000",
"0.000",
"0.000"
],
"StockISOUoM": [
"XXXXX",
"XXXXX",
"XXXXX"
],
"StockUoM": [
"XXXXX",
"XXXXX",
"XXXXX"
],
"StockStatus": [
"XXXXX",
"XXXXX",
"XXXXX"
]
},
{
"LastUpdated": "XXXXX",
"MaterialCode": "na-XXXXX",
"StorageLocationId": "XXXXX",
"StorageLocationLastUpdated": "XXXXX",
"StockAmount": [
"0.000",
"0.000",
"0.000"
],
"StockISOUoM": [
"XXXXX",
"XXXXX",
"XXXXX"
],
"StockUoM": [
"XXXXX",
"XXXXX",
"XXXXX"
],
"StockStatus": [
"XXXXX",
"XXXXX",
"XXXXX"
]
}
]
Need help in writing a jolt spec so that we get a flattened Array
You can add one more shift transformation to separate the content of the currently generated three objects triple so as to generate 3 x 3 = 9 objects by walking along with a component of the arrays start with Stock(I've picked StockStatus in this case), then prune all of the key names through use of an extra shift transformation such as
[
{
"operation": "shift",
<body of the current spec>
},
{
"operation": "shift",
"spec": {
"*": {
"StockStatus": {
"*": {
"#(2,LastUpdated)": "&3.&1.LastUpdated",
"#(2,MaterialCode)": "&3.&1.MaterialCode",
"#(2,StorageLocationId)": "&3.&1.StorageLocationId",
"#(2,StorageLocationLastUpdated)": "&3.&1.StorageLocationLastUpdated",
"#(2,StockAmount[&])": "&3.&1.StockAmount",
"#(2,StockISOUoM[&])": "&3.&1.StockISOUoM",
"#(2,StockUoM[&])": "&3.&1.StockUoM",
"#": "&3.&1.StockStatus"
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": ""
}
}
}
]
where &3 stands for going three levels up in order to reach the uppermost indices(they are 0,1,2), which are one level above the StockStatus key's level, and &1 to reach the indices of StockStatus array(they are 0,1,2 too) to separate each element groups into 3 x 3 = 9 different objects. The ampersands within the #(2,Stock....[&]) keys represent looking up the indices of StockStatus array as well.

How to Add an Object to a Json Array Depending a value of another Key in the File Using JoltTransformationJson in NiFi

This is my first time to use JoltTransformationJson, so I have limited knowledge and experience on that. Please help me with this complicated project.
Request:
when the payment.code <> "paid", I have to do the following two things for the file.
to change the payment.code ="denied" and payment.text ="denied"
to add a JSON object to item.ADJ
When the payment.code =="paid", don't need to change anything.
Input :
{
"resourceType": "E",
"id": "11",
"identifier": [
{
"type": {
"coding": [
{
"system": "sys1",
"code": "aaa"
}
]
},
"value": "212"
},
{
"type": {
"coding": [
{
"system": "sys2",
"code": "RRR"
}
]
},
"value": "367"
}
],
"status": "active",
"created": "2021-08-05T02:43:48+00:00",
"outcome": "complete",
"item": [
{
"sequence": 1,
"product": {
"coding": [
{
"system": "example",
"code": "abc",
"display": "ABC"
}
],
"text": "ABC"
},
"servicedDate": "2021-08-04",
"quantity": {
"value": 60
},
"ADJ": [
{
"category": {
"coding": [
{
"system": "code1",
"code": "code1",
"display": "CODE1"
}
],
"text": "CODE1"
},
"amount": {
"value": 46.45,
"currency": "USD"
}
},
{
"category": {
"coding": [
{
"system": "code2",
"code": "code2",
"display": "CODE2"
}
],
"text": "CODE2"
},
"amount": {
"value": 12.04,
"currency": "USD"
}
}
]
}
],
"payment": {
"type": {
"coding": [
{
"system": "http://payment.com",
"code": "reversed/cancelled"
}
],
"text": "cancelled"
}
}
}
My Expected Output :
{
"resourceType": "E",
"id": "11",
"identifier": [
{
"type": {
"coding": [
{
"system": "sys1",
"code": "aaa"
}
]
},
"value": "212"
},
{
"type": {
"coding": [
{
"system": "sys2",
"code": "RRR"
}
]
},
"value": "367"
}
],
"status": "active",
"created": "2021-08-05T02:43:48+00:00",
"outcome": "complete",
"item": [
{
"sequence": 1,
"product": {
"coding": [
{
"system": "example",
"code": "abc",
"display": "ABC"
}
],
"text": "ABC"
},
"servicedDate": "2021-08-04",
"quantity": {
"value": 60
},
"ADJ": [
{
"category": {
"coding": [
{
"system": "code1",
"code": "code1",
"display": "CODE1"
}
],
"text": "CODE1"
},
"amount": {
"value": 46.45,
"currency": "USD"
}
},
{
"category": {
"coding": [
{
"system": "code2",
"code": "code2",
"display": "CODE2"
}
],
"text": "CODE2"
},
"amount": {
"value": 12.04,
"currency": "USD"
}
},
{// new object I want to insert into
"category": {
"coding": [
{
"system": "sys_denail",
"code": "denialreason"
}
],
"reason": {
"coding": [
{
"system": "https://example.com",
"code": "A1"
}
],
"text": "unknown"
}}
}
]
}
],
"payment": {
"type": {
"coding": [
{
"system": "http://payment.com",
"code": "denied" //change the value to denied
}
],
"text": "denied" //change the value to denied
}
}
}
Edit : I've tried to answer the second case by myself to be evaluated after the first case is answered
Welcome to SO, please ask minimal and reproducible questions, and show your effort tried for the future.
What you need is to use a conditional logic along with placeholder values with ampersand symbols depending on the levels of each key name within the tree.
I have partially answered, which will handle the bottom part of your question. Indeed the logic for the rest(inserting an object to the array will be similiar)
So, consider having a look at the following solution
[
{
"operation": "shift",
"spec": {
"*": "&",
"payment": {
"type": {
"coding": {
"*": {
"*": "&4.&3.&2[&1].&",
"code": {
"paid": {
"#1": "&6.&5.&4[&3].&2",
"#(4,text)": "&6.text"
},
"*": {
"#denied": "&6.&5.&4[&3].code",
"#(4,text)": {
"#denied": "&6.text"
}
}
}
}
}
}
}
}
}
]
Edit(for your own answer related to adding an object):
your current idea of using shift after default transformation spec is pretty good, you can rephrase like
[
{
"operation": "default",
"spec": {
"temp_deny": {
"denialreason": {
"category": {
"coding": [
{
"system": "sys_denail",
"code": "denialreason"
}
],
"reason": {
"coding": [
{
"system": "https://example.com",
"code": "A1"
}
],
"text": "unknown"
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": "&",
"item": {
"*": {
"*": "&2[&1].&",
"ADJ": {
"#": "&3[&2].&",
"#(4,temp_deny)": "&3[&2].&"
}
}
}
}
}
]

How to match on multiple fields per array item in elastic search

I am trying to create an elastic search query to match multiple fields inside of an object inside of an array.
For example, the Elastic Search structure I am querying against is similar to the following:
"hits": [
{
"_index": "titles",
"_type": "title",
...
"_source": {
...
"genres": [
{
"code": "adventure",
"priority": 1
},
{
"code": "action",
"priority": 2
},
{
"code": "horror",
"priority": 3
}
],
...
},
...
]
And what I am trying to do is match on titles with specific genre/priority pairings. For example, I am trying to match all titles with code=action and priority=1, but my query is returning too many results. The above title is hit during this example due to the fact that the genre list contains both a genre with code=action AND another genre that matches priority=1. My query is similar to the following:
"query": {
"bool": {
"filter": [
{
"bool": {
"must":[
{"term": {
"genres.code": {
"value": "action",
"boost": 1.0
}
}},
{"term": {
"genres.priority": {
"value": 1,
"boost": 1.0
}
}}
]
}
},
...
}
Is there any way to form the query in order to match a title with a single genre containing both priority=1 AND code=action?
I have recreated your problem. I added the following mapping
PUT titles
{
"mappings": {
"title": {
"properties": {
"author": {
"type": "text"
},
"genres": {
"type": "nested"
}
}
}
}
}
Then I added values to the index. This was what was inserted
"hits": {
"total": 3,
"max_score": 1,
"hits": [
{
"_index": "titles",
"_type": "title",
"_id": "2",
"_score": 1,
"_source": {
"author": "Author 1",
"genres": [
{
"code": "adventure",
"priority": 2
},
{
"code": "action",
"priority": 3
},
{
"code": "horror",
"priority": 1
}
]
}
},
{
"_index": "titles",
"_type": "title",
"_id": "1",
"_score": 1,
"_source": {
"author": "Author 2",
"genres": [
{
"code": "adventure",
"priority": 3
},
{
"code": "action",
"priority": 1
},
{
"code": "horror",
"priority": 2
}
]
}
},
{
"_index": "titles",
"_type": "title",
"_id": "3",
"_score": 1,
"_source": {
"author": "Author 3",
"genres": [
{
"code": "adventure",
"priority": 3
},
{
"code": "action",
"priority": 1
},
{
"code": "horror",
"priority": 2
}
]
}
}
]
}
My query is:
GET titles/title/_search
{
"query": {
"nested": {
"path": "genres",
"query": {
"bool": {
"must": [
{
"term": {
"genres.code": {
"value": "horror"
}
}
},
{
"term": {
"genres.priority": {
"value": 1
}
}
}
]
}
}
}
}
}
The query returns
"_source": {
"author": "Author 1",
"genres": [
{
"code": "adventure",
"priority": 2
},
{
"code": "action",
"priority": 3
},
{
"code": "horror",
"priority": 1
}
]
}
This title is the only one that has code = 'horror' and priority = 1.

Stellar cross currency transaction doesn't work

I'm unable to execute payment transaction in Stellar testnet.
Initially i use find_path:
curl -X POST https://test.stellar.org:9002 -d '
{
"method": "static_path_find",
"params": [
{
"source_account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"destination_account": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"source_currencies" : [ { "currency" : "SGD", "issuer" : "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r"} ],
"destination_amount": {
"currency": "MYR",
"value": "1",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
}
}
]
}'
The result I get:
{
"result": {
"alternatives": [
{
"paths_computed": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
],
"source_amount": {
"currency": "SGD",
"issuer": "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r",
"value": "0.375"
}
}
],
"destination_account": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"destination_currencies": [
"MYR",
"STR"
],
"status": "success"
}
}
Then I trying to broadcast transaction in the network:
curl -X POST https://test.stellar.org:9002 -d '
{
"method": "submit",
"params": [
{
"secret": "sfk7dUd4N8cxVFVowsZL4DQgonNP9k8WFBgaV2NmwEQKGzWuqXT",
"tx_json": {
"TransactionType": "Payment",
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"Amount": {
"currency": "MYR",
"value": "1",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
},
"Paths": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
]
}
}
]
}'
And finally I'm getting unsuccessful result when transaction passed through consensus:
{
"engine_result": "tecPATH_PARTIAL",
"engine_result_code": 101,
"engine_result_message": "Path could not send full amount.",
"ledger_hash": "82BCF42941EF00BEA9E575B696CD88EC7E14FDE8CFD39FDA6A76B5710FDD0755",
"ledger_index": 704612,
"meta": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Balance": "199999960",
"Flags": 0,
"OwnerCount": 1,
"Sequence": 5
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "D3433DEE556200D8AB72DED7156A597A273103D2BC50F526193EB9C4D8C8B735",
"PreviousFields": {
"Balance": "199999970",
"Sequence": 4
},
"PreviousTxnID": "6ADF48B45D95B3ABD20FD78F95F7E4F20D91FF5D169ECC5EFD6DB0CA78BEA486",
"PreviousTxnLgrSeq": 704445
}
}
],
"TransactionIndex": 0,
"TransactionResult": "tecPATH_PARTIAL"
},
"status": "closed",
"transaction": {
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Amount": {
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"value": "1"
},
"Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"Fee": "10",
"Flags": 2147483648,
"Paths": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
],
"Sequence": 4,
"SigningPubKey": "4B640AC0C64AEF1C97EAAD0629CADDCA95FBA5F095BD20BD6282BEC450A125B1",
"TransactionType": "Payment",
"TxnSignature": "7BF5772EB916F20F56C5F148E99C3C3DD77C2916EAA47AB2D7FA8306F2B4A9D3FA4B789BDB79899A634B0C33F50A6ACB447CA6A9633C1C73BAB754FBFE74C105",
"date": 485412700,
"hash": "846AB6502D3B7A3137B2B538E6616B9C4459D2A67C48E58AF6B64F4659FF0016"
},
"type": "transaction",
"validated": true
}
Why? What I did wrong? I really can't understand...
Anyway I found the problem.
I forgot to add required SendMax parameter when submitting transaction.
curl -X POST https://test.stellar.org:9002 -d '
{
"method": "submit",
"params": [
{
"secret": "sfk7dUd4N8cxVFVowsZL4DQgonNP9k8WFBgaV2NmwEQKGzWuqXT",
"tx_json": {
"TransactionType": "Payment",
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"Amount": {
"currency": "MYR",
"value": "1",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
},
"Paths": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
],
"SendMax" : { "currency" : "SGD", "value" : "0.375", "issuer": "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r" }
}
}
]
}'