Reputation: 1177
I'm calling a rest api with pagination and in the response I get the "next" link in the HTTP Header, in the following format: Link <https://aaaaaa/bbb/ccc/ddd/version/2.1.1/locations/?date_from=1601-01-01T00%3a00%3a00Z&date_to=2019-04-24T17%3a03%3a29Z&offset=100&limit=100
>; rel="next"
I can easily get the value of the HTTP Header link parameter
But there is no regex expression in Azure Logic Apps that I can use to further parse the link value in just the part between < and >
One option is to write an Azure Function that deals with this, but I'm looking for something simpler (if possible)
{
"inputs": {
"name": "newLink",
"value": "@{outputs('HTTP')['headers']?['Link']}"
}
}
the newLink variable now contains the complete value of link. But I need only the part between the < and the >
Any hints on how I can parse the newLink variable into what I need (without using azure functions) is highly appreciated.
Upvotes: 0
Views: 2710
Reputation: 1550
You can use spilt()
function as shown below:
@split(split(triggerOutputs()['headers']?['Link'],'<')[1],'>')[0]
Designer View
Code View
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Response": {
"inputs": {
"body": "@split(split(triggerOutputs()['headers']?['Link'],'<')[1],'>')[0]",
"statusCode": 200
},
"kind": "Http",
"runAfter": {},
"type": "Response"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
}
}
Postman Call:
Upvotes: 5