Passing Splice ExtraArgs to JSON API

Hi, is anyone familiar with how textmap values can be passed as context to the json ledger api

Something like this:

extraArgs = Api.Token.MetadataV1.ExtraArgs with
                context = Api.Token.MetadataV1.ChoiceContext with
                    values = TextMap.fromList [
                        ("cid", Api.Token.MetadataV1.AV_ContractId _any_contractId)           
                        ]
                meta = Api.Token.MetadataV1.emptyMetadata

My request body has something like this:

"extraArgs": {
                "context": {
                    "values": [
                        {
                             "cid": "004b....."
                        }    
                    ]
                },
                "meta": {"values":{}}
         }

I get response like this. I’m not sure what I’m doing wrong

{
    "code": "LEDGER_API_INTERNAL_ERROR",
    "cause": "Expected ujson.Obj (data: [{\"cid\":\"004b4041a8bd607f6e77f15dd8ee1d9a662fb219dcbe05bb0c98b44713c51a9b14ca1212201e9c0b1fd253eab1860f77988167ade08be8ae69b5684d2ace0941f8e229262c\"}])",
    "correlationId": "4436aec02936ddd4c3a6e2ffef403f5d",
    "traceId": "4436aec02936ddd4c3a6e2ffef403f5d",
    "context": {
        "throwableO": "Some(ujson.Value$InvalidData: Expected ujson.Obj (data: [{\"cid\":\"004b4041a8bd607f6e77f15dd8ee1d9a662fb219dcbe05bb0c98b44713c51a9b14ca1212201e9c0b1fd253eab1860f77988167ade08be8ae69b5684d2ace0941f8e229262c\"}]))"
    },
    "resources": [],
    "errorCategory": 4,
    "grpcCodeValue": 13,
    "retryInfo": null,
    "definiteAnswer": false
}

I got the fix

Should have been passed as tag and value

"extraArgs": {
                "context": {
                    "values": 
                        {
                            "cid": {
                                "tag": "AV_ContractId",
                                "value": "004b4041a8bd607f6e77f15dd8ee1d9a662fb219dcbe05bb0c98b44713c51a9b14ca1212201e9c0b1fd253eab1860f77988167ade08be8ae69b5684d2ace0941f8e229262c"
                            }
                        }
                },
                "meta": {"values":{}}
            }
1 Like