<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: return specified fields only with api call in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399034#M287</link>
    <description>&lt;P&gt;Thank you for the quick responses.  I had hoped I was just missing something, &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I will carry on parsing and extracting.&lt;/P&gt;&lt;P&gt;Have a great day!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2023 20:29:21 GMT</pubDate>
    <dc:creator>blshaw32</dc:creator>
    <dc:date>2023-12-18T20:29:21Z</dc:date>
    <item>
      <title>return specified fields only with api call</title>
      <link>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399031#M284</link>
      <description>&lt;P&gt;For example:  I'm trying to get just the Organization name:&lt;/P&gt;&lt;P&gt;&lt;A href="https://api.meraki.com/api/v1/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api.meraki.com/api/v1/&lt;/A&gt;&lt;SPAN&gt;organizations/{organizationId}?fields=name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or find out the organizationId for a company called "CompanyName"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://api.meraki.com/api/v1/organizations/{organizationId}?fields=id&amp;amp;name=" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api.meraki.com/api/v1/organizations/{organizationId}?fields=id&amp;amp;name=&lt;/A&gt;"CompanyName"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried many different variations of the above, and search in the forums to no avail.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Other API's I've worked with have a way to pass conditions into the request and only get back the single field you need.  That would sure save a bunch of parsing when the payload returns to my console.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thaks in advance for the help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 19:45:53 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399031#M284</guid>
      <dc:creator>blshaw32</dc:creator>
      <dc:date>2023-12-18T19:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: return specified fields only with api call</title>
      <link>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399032#M285</link>
      <description>&lt;P&gt;Natively (if I'm not mistaken) you won't be able to do it this way. Today, to extract the information the way I need it, I am using the following code.&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;import json&lt;/P&gt;&lt;P&gt;# Make the API request&lt;BR /&gt;response = requests.get('&lt;A href="https://api.meraki.com/api/v1/organizations/{organizationId" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api.meraki.com/api/v1/organizations/{organizationId&lt;/A&gt;}')&lt;/P&gt;&lt;P&gt;# Convert the response to JSON&lt;BR /&gt;data = response.json()&lt;/P&gt;&lt;P&gt;# Extract the field you need&lt;BR /&gt;org_name = data['name']&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 20:01:41 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399032#M285</guid>
      <dc:creator>aleabrahao</dc:creator>
      <dc:date>2023-12-18T20:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: return specified fields only with api call</title>
      <link>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399033#M286</link>
      <description>&lt;P&gt;The current API returns what it likes, for a given API call it can also vary depending on context. There's no way to limit which field(s) are returned.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 20:02:04 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399033#M286</guid>
      <dc:creator>sungod</dc:creator>
      <dc:date>2023-12-18T20:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: return specified fields only with api call</title>
      <link>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399034#M287</link>
      <description>&lt;P&gt;Thank you for the quick responses.  I had hoped I was just missing something, &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I will carry on parsing and extracting.&lt;/P&gt;&lt;P&gt;Have a great day!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 20:29:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399034#M287</guid>
      <dc:creator>blshaw32</dc:creator>
      <dc:date>2023-12-18T20:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: return specified fields only with api call</title>
      <link>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399035#M288</link>
      <description>&lt;P&gt;Here is an example in Python of getting an org and network ID by searching on the name using the Meraki Python SDK.&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;# This function retrieves the netId
def getNetId(orgName,netName):
	orgId=None
	netId=None

	# Search for the org
	for org in dashboard.organizations.getOrganizations():
		if org['name'] == orgName:
			orgId=org['id']
			break;

	if orgId == None:
		print("Invalid organization name supplied: "+orgName)			
		exit(-1)

	# Search for the network
	for net in dashboard.organizations.getOrganizationNetworks(orgId):
		if net['name'] == netName:
			netId=net['id']
			break;

	# If no network, search for a template
	if netId == None:
		for net in dashboard.organizations.getOrganizationConfigTemplates(orgId):
			if net['name'] == netName:
				netId=net['id']
				break;

	# Nothing found matching at all
	if netId == None:
		print("Invalid network name supplied: "+netName)			
		exit(-1)

	return netId&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Dec 2023 20:22:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/return-specified-fields-only-with-api-call/m-p/5399035#M288</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2023-12-19T20:22:17Z</dc:date>
    </item>
  </channel>
</rss>

