How do you setup PATCH as a Sink in Azure Data Factory to modify Jira Align data
Asked by Mark Northcott:

Hello all,

I'm trying to feed some data back into JA via REST API PATCH command after I have extracted via GET, and modified.  
I can use PATCH command in JA using Swagger and Curl and the records will update.

However, if I setup as SINK in copy Data activity in Azure Data Factory, it always produces the following error:

Failure happened on 'Sink' side. ErrorCode=RestCallFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Rest call failed with client error, status code 400 BadRequest, please check your activity settings.

Request URL: <https://xxxxx.jiraalign.com/rest/align/api/2/Risks/103>.

Response: **Cannot update risk with id 103. Value cannot be null. (Parameter 'path')**,Source=Microsoft.DataTransfer.ClientLibrary,'

I have tried to make it as bare bones as possible, trying to update a simple field but I get the same error everytime. It doesn't matter which I am trying to update (Risk or Story) or the fields.

JSON (See Below) clearly shows where values are coming from in Source and a test of the query in source does show values returned in each cell.

Any advice would help as this is stumping me.

{  
"name": "TEST_PATCH Raw JA",  
"properties": {  
"activities": \[  
{  
"name": "Copy data1",  
"type": "Copy",  
"dependsOn": \[\],  
"policy": {  
"timeout": "0.12:00:00",  
"retry": 0,  
"retryIntervalInSeconds": 30,  
"secureOutput": false,  
"secureInput": false  
},  
"userProperties": \[\],  
"typeProperties": {  
"source": {  
"type": "AzureSqlSource",  
"sqlReaderQuery": "Select \[RiskID\], \[IRR New\], \[RRR New\] From \[ATSK\].\[RiskJiraAlign\] Where \[RiskID\] =103",  
"queryTimeout": "02:00:00",  
"partitionOption": "None"  
},  
"sink": {  
"type": "RestSink",  
"httpRequestTimeout": "00:03:40",  
"requestInterval": 10,  
"requestMethod": "PATCH",  
"writeBatchSize": 10000,  
"httpCompressionType": "none"  
},  
"enableStaging": false,  
"translator": {  
"type": "TabularTranslator",  
"mappings": \[  
{  
"source": {  
"name": "RiskID",  
"type": "Int32"  
},  
"sink": {  
"path": "$\['id'\]"  
}  
},  
{  
"source": {  
"name": "IRR New",  
"type": "String"  
},  
"sink": {  
"path": "$\['description'\]"  
}  
}  
\]  
}  
},  
"inputs": \[  
{  
"referenceName": "ResourceSQLJiraAlignEI",  
"type": "DatasetReference",  
"parameters": {  
"DynamicSchema": "ATSK",  
"DynamicTable": "RiskJiraAlign"  
}  
}  
\],  
"outputs": \[  
{  
"referenceName": "TESTRestPatchRawJA",  
"type": "DatasetReference"  
}  
\]  
}  
\],  
"annotations": \[\],  
"lastPublishTime": "2022-10-30T03:45:13Z"  
},  
"type": "Microsoft.DataFactory/factories/pipelines"  
}


Answers:
author: Allan Maxwell
body: Are you able to capture the exact HTTP PATCH request? Seems like the problem lies in what you are passing to the Jira Align API. Are you passing JSON in the request body?

comments: author: Mark Northcott
body: Hello Allan,  
There doesn't seem to be a request body.  
Unlike Postman, swagger, etc Azure Data Factory Copy Data is it's own thing. It maps values from one dataset to another.   

I assume, once you have given it the Sink field details and the souce values, it creates the request body eg

\[

{

"op": "replace",

"path": "/customFields/5/customfield_90014/0/value",

"value": "D-Low"

}

\]

But I can't see it anywhere.


Tags: cloud

patch

rest-api