Extract data from http response

Describe the problem/error/question

I need to extract data from a HTTP request and use it as part of a querystring in a second request

What is the error message (if any)?

NA

Please share your workflow

{
“name”: “WF GetToken”,
“nodes”: [
{
“parameters”: {},
“id”: “8f601792-8434-4021-be71-715fc7b7875f”,
“name”: “When clicking "Execute Workflow"”,
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
760,
380
]
},
{
“parameters”: {
“method”: “POST”,
“url”: “http://o.net:1804/Testing/oslc/am/login/”,
“sendBody”: true,
“contentType”: “raw”,
“body”: “uid=uuu;pwd=ppp;”,
“options”: {}
},
“id”: “1a0e0a83-d062-483e-b3aa-2dc8b7a6565b”,
“name”: “HTTP Request”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.1,
“position”: [
980,
380
]
}
],
“pinData”: {},
“connections”: {
“When clicking "Execute Workflow"”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: false,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “b2812fb5-924b-43f4-96d8-c3bb2612eb28”,
“id”: “8i821GGq0eYYbVVn”,
“meta”: {
“instanceId”: “325cf3c56cd1179b1f485fa03a81545e175423742973541951c56aebf5a617bd”
},
“tags”:
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

I receive a Json with an embedded xml.

[
{
“data”: “<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#\” xmlns:ss="http://www.sparxsystems.com.au/oslc_am#\" xmlns:foaf="FOAF Vocabulary Specification“>ss:loginss:version5.1.128.2650</ss:version>ss:readonlyconnectionfalse</ss:readonlyconnection>ss:securityenabledmodeltrue</ss:securityenabledmodel>ss:modelrepositoryMicrosoft SQL Server</ss:modelrepository>ss:prolicenseTeam Server</ss:prolicense>ss:prolicenseexpirybbbbbbbb</ss:prolicenseexpiry>ss:userfullnamefoaf:Personfoaf:namebbbb</foaf:name>foaf:nickaaaa</foaf:nick></foaf:Person></ss:userfullname>ss:useridentifier{F5A6606E-FEAC-41be-94E9-58D4EAF33189}</ss:useridentifier>ss:defaultdiagramidentifierdg_{B48E9898-DE9B-4f4e-91F5-2DE3FF8EA595}</ss:defaultdiagramidentifier>ss:elementpermissiontrue</ss:elementpermission>ss:lockelementpermissiontrue</ss:lockelementpermission>ss:diagramcreatepermissiontrue</ss:diagramcreatepermission>ss:diagramupdatepermissiontrue</ss:diagramupdatepermission>ss:testpermissiontrue</ss:testpermission>ss:resourceallocationpermissiontrue</ss:resourceallocationpermission>ss:maintenanceitempermissiontrue</ss:maintenanceitempermission>ss:projectmanagementitempermissiontrue</ss:projectmanagementitempermission>ss:relationshipmatrixpermissiontrue</ss:relationshipmatrixpermission></ss:login></rdf:RDF>”
}
]

I need to get hold of ss:useridentifier to use in my next node which is another HTTP request (GET) where ss:useridentifier is part of a querystring

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Information on your n8n setup

  • **n8n version:1.20.0, Community edition
  • **Database (default: SQLite): (I have no idea)
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):Default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • **Operating system:Windows 10

@TommyK , assuming your XML string is correctly formatted, which means it represents the data as shown below

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:ss="http://www.sparxsystems.com.au/oslc_am#"
	xmlns:foaf="FOAF Vocabulary Specification">
	<ss:login>
		<ss:version>5.1.128.2650</ss:version>
		<ss:readonlyconnection>false</ss:readonlyconnection>
		<ss:securityenabledmodel>true</ss:securityenabledmodel>
		<ss:modelrepository>Microsoft SQL Server</ss:modelrepository>
		<ss:prolicense>Team Server</ss:prolicense>
		<ss:prolicenseexpiry>bbbbbbbb</ss:prolicenseexpiry>
		<ss:userfullname>
			<foaf:Person>
				<foaf:name>bbbb</foaf:name>
				<foaf:nick>aaaa</foaf:nick>
			</foaf:Person>
		</ss:userfullname>
		<ss:useridentifier>{F5A6606E-FEAC-41be-94E9-58D4EAF33189}</ss:useridentifier>
		<ss:defaultdiagramidentifier>dg_{B48E9898-DE9B-4f4e-91F5-2DE3FF8EA595}</ss:defaultdiagramidentifier>
		<ss:elementpermission>true</ss:elementpermission>
		<ss:lockelementpermission>true</ss:lockelementpermission>
		<ss:diagramcreatepermission>true</ss:diagramcreatepermission>
		<ss:diagramupdatepermission>true</ss:diagramupdatepermission>
		<ss:testpermission>true</ss:testpermission>
		<ss:resourceallocationpermission>true</ss:resourceallocationpermission>
		<ss:maintenanceitempermission>true</ss:maintenanceitempermission>
		<ss:projectmanagementitempermission>true</ss:projectmanagementitempermission>
		<ss:relationshipmatrixpermission>true</ss:relationshipmatrixpermission>
	</ss:login>
</rdf:RDF>

you can get the ss:useridentifier with help of XML node. This is demonstrated below.

2 Likes

Thanks! Works like a charm!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.