Parse JsonPathOnURL results to seperate coumns?

#1

Hey All,

Have been searching, but cannot find, apologies if this is some place obvious, but how to do I pull multiple items from jsonpathonURL without making multiple api requests (because charged per api request)?

For example, on https://emailrep.io/query/elateef%40amvensys.com, would like to get $.email, $.reputation, $.references, $.details.deliverable dumped to seperate columns. So far have just been doing $. to dump all, and then extracting with regex formulas, which is a pain.

Suggestions?

Documentation on emailrep.io https://emailrep.io/, but is just example for other api's as well

#2

Hi,

That is a great question and the simple answer is it's not easy to do with a single JsonPathOnUrl formula. The most robust method would be to create your own connector which allows you to extract multiple values at once and specify individual JsonPaths and format types.

It is pretty straight forward to create a custom connector by copy pasting from previous connectors. See the Connectors folder or the Seotools repo. I've made a mockup based on the API docs:

<?xml version="1.0" encoding="UTF-8"?>
<Suite Title="EmailRep" Id="EmailRep" Category="Email" RequireVersion="8.0" SourceUrl="" HelpUrl="" HelpText="Documentation">

	<Settings HelpText="What's this?">
		<Text Id="ApiKey" Title="API Key" Required="true"/>
	</Settings>

	<RestConnector Id="EmailRep" Title="EmailRep">
		<Parameters>
			<Text Id="Email" Title="Email" Required="true"/>
		</Parameters>
		<Fetch>
			<HttpSettings>
				<RequestContentType>application/json</RequestContentType>
        <RequestHeaders>
          <Header Name='Key'>@Model.ApiKey</Header>
        </RequestHeaders>
      </HttpSettings>
			<Fetch.Url>
				<![CDATA[
					https://emailrep.io/@Model.Email
				]]>
			</Fetch.Url>
		</Fetch>
		<Parse>
			<JsonPath Expr="$.email" Id="Email" Title="Email" Converter="String"/>
			<JsonPath Expr="$.reputation" Id="Reputation" Title="Reputation" Converter="String"/>
			<JsonPath Expr="$.suspicious" Id="Suspicious" Title="Suspicious" Converter="Bool"/>
			<JsonPath Expr="$.references" Id="References" Title="References" Converter="Int"/>
		</Parse>
	</RestConnector>

</Suite>