# Source Response coming as a String

**URL:** <https://developer.sailpoint.com/discuss/t/source-response-coming-as-a-string/86706>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud, entitlements\
**Created:** [October 23, 2024, 7:03am UTC](https://developer.sailpoint.com/discuss/t/source-response-coming-as-a-string/86706 "2024-10-23T07:03:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yunus\_merck](https://avatars.discourse-cdn.com/v4/letter/y/22d042/32.png) [@yunus\_merck](https://developer.sailpoint.com/discuss/u/yunus_merck)\
**Post date:** [October 23, 2024, 7:03am UTC](https://developer.sailpoint.com/discuss/t/source-response-coming-as-a-string/86706/1 "2024-10-23T07:03:52Z")

</div>

> ‼ Please be sure you’ve read the [docs](https://developer.sailpoint.com/idn/docs/) and [API specs](https://developer.sailpoint.com/idn/api/getting-started) before asking for help. Also, please be sure you’ve [searched](https://developer.sailpoint.com/discuss/search?expanded=true) the forum for your answer before you create a new topic.

Hi,  
I am trying to list the sources in my DEV tenant using the /v3/sources api using Powershell. Since my tenant has more than 400 sources, I was using the offset to list the first 250 ,parse and then listing the rest and parse.  
While parsing the response, I was able to parse the first 250 sources to get the IDs and Name, however it did not work for the rest.  
For troubleshooting, I started listing the sources one by one and found that for one source the response.GetType() is System.String rather than System.Object and that’s why it was breaking.  
I tried to convert the string response into Json object as respsoneJSon= response | ConvertFrom-Json but that is also not working.

I wanted to understand why this source has a different response type compared to others and how we can handle it in powershell? I can’t skip the source as I need the sourceId for further processing of script.

Note- The source in IDN is direct connector and in healthy state. From postman, able to get the source too.

---

<div class="post-metadata">

**Author:** ![neeraj99](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/neeraj99/32/14001_2.png) [@neeraj99](https://developer.sailpoint.com/discuss/u/neeraj99)\
**Post date:** [October 23, 2024, 7:15am UTC](https://developer.sailpoint.com/discuss/t/source-response-coming-as-a-string/86706/2 "2024-10-23T07:15:59Z")

</div>

I believe you have everything setup, So whenever you are doing the pagination save the response to a file and then call this method. I am also using this same exact thing and it works in this case for me.

```auto
function getAllSources() {
	#Response File Created By API    
    $inputFile = "./Source_Export.json" #this contains my source information i.e 250 sources information saved to this file.
    $sourceContent = Get-Content $inputFile -Raw | ConvertFrom-Json
	
    foreach ($singleSource in $sourceContent) {			
		#Get the Source ID
		$sourceID = $singleSource.id
		$sourceName = $singleSource.name
		<# SOME OTHER PROCESS RUNNING HERE #>
		
		#display that in screen as well.
		Write-Host "$sourceName = $sourceID"
    }
	
    #Delete the created "./Source_Export.json" file from response
    Remove-Item $inputFile
}

```

Letme know if this works. 🙂

---

<div class="post-metadata">

**Author:** ![yunus\_merck](https://avatars.discourse-cdn.com/v4/letter/y/22d042/32.png) [@yunus\_merck](https://developer.sailpoint.com/discuss/u/yunus_merck)\
**Post date:** [October 23, 2024, 7:20am UTC](https://developer.sailpoint.com/discuss/t/source-response-coming-as-a-string/86706/3 "2024-10-23T07:20:34Z")

</div>

Thanks for the response. I will try that. But do you have an idea why the response is coming as String for just one source ?

---

<div class="post-metadata">

**Author:** ![yunus\_merck](https://avatars.discourse-cdn.com/v4/letter/y/22d042/32.png) [@yunus\_merck](https://developer.sailpoint.com/discuss/u/yunus_merck)\
**Post date:** [October 23, 2024, 8:14am UTC](https://developer.sailpoint.com/discuss/t/source-response-coming-as-a-string/86706/4 "2024-10-23T08:14:08Z")

</div>

HI Neeraj,  
I tried your way too but that also did not work. In your case, was there any response of String type?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [December 22, 2024, 8:14am UTC](https://developer.sailpoint.com/discuss/t/source-response-coming-as-a-string/86706/5 "2024-12-22T08:14:22Z")

</div>

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