A program to recognize and reward our most engaged community members
<?xml version="1.0" encoding="UTF-8" standalone="no"?><process version="5.3.012"> <context> <input/> <output/> <macros/> </context> <operator activated="true" class="process" compatibility="5.3.012" expanded="true" name="Process"> <description>This process allows Applications to connect to Twitter using the Application Only authorisation level. For documentation for Twitter REST 1.1 API see here: https://dev.twitter.com/docs/auth/application-only-auth<;/description> <process expanded="true"> <operator activated="true" class="subprocess" compatibility="5.3.012" expanded="true" height="76" name="Credentials" width="90" x="45" y="30"> <process expanded="true"> <operator activated="true" class="generate_data_user_specification" compatibility="5.3.012" expanded="true" height="60" name="Fuel Data" width="90" x="45" y="75"> <list key="attribute_values"> <parameter key="Username" value=""username_here""/> <parameter key="Password" value=""password_here""/> </list> <list key="set_additional_roles"/> </operator> <operator activated="true" class="loop_attributes" compatibility="5.3.012" expanded="true" height="76" name="Loop Attributes" width="90" x="179" y="75"> <description>It's good practive to encode the URL before converting to Base64 (same as when calling, but this analyst was lazy) </description> <parameter key="attribute_filter_type" value="subset"/> <parameter key="attributes" value="Password|Username"/> <process expanded="true"> <operator activated="true" class="web:encode_urls" compatibility="5.3.001" expanded="true" height="76" name="Encode URLs" width="90" x="179" y="120"> <parameter key="url_attribute" value="%{loop_attribute}"/> <parameter key="encoding" value="US-ASCII"/> </operator> <connect from_port="example set" to_op="Encode URLs" to_port="example set input"/> <connect from_op="Encode URLs" from_port="example set output" to_port="example set"/> <portSpacing port="source_example set" spacing="0"/> <portSpacing port="sink_example set" spacing="0"/> <portSpacing port="sink_result 1" spacing="0"/> </process> </operator> <operator activated="true" class="generate_attributes" compatibility="5.3.012" expanded="true" height="76" name="Generate Attributes" width="90" x="313" y="75"> <description>Concatenate Username and Password(This might change depending on how your authorization is based) If for example it's based on the RFC6749 (http://tools.ietf.org/html/rfc6749#section-4.4) specification then you need an extra step to get your authorization token. </description> <list key="function_descriptions"> <parameter key="token" value="concat(Username,":",Password)"/> </list> </operator> <operator activated="true" class="select_attributes" compatibility="5.3.012" expanded="true" height="76" name="Select Attributes" width="90" x="112" y="210"> <parameter key="attribute_filter_type" value="subset"/> <parameter key="attributes" value="|token"/> </operator> <operator activated="true" class="execute_script" compatibility="5.3.012" expanded="true" height="76" name="Execute Script" width="90" x="246" y="210"> <description>Important bit!! Convert credentials to Base64. As there is no operator for this so a small piece of Groovy script is executed on the attribute. </description> <parameter key="script" value="ExampleSet eSet = operator.getInput(ExampleSet.class); for (Example example : eSet) { def s = example["token"] String encoded = s.bytes.encodeBase64().toString() example["token"] = encoded 	} return eSet;"/> </operator> <connect from_op="Fuel Data" from_port="output" to_op="Loop Attributes" to_port="example set"/> <connect from_op="Loop Attributes" from_port="example set" to_op="Generate Attributes" to_port="example set input"/> <connect from_op="Generate Attributes" from_port="example set output" to_op="Select Attributes" to_port="example set input"/> <connect from_op="Select Attributes" from_port="example set output" to_op="Execute Script" to_port="input 1"/> <connect from_op="Execute Script" from_port="output 1" to_port="out 1"/> <portSpacing port="source_in 1" spacing="0"/> <portSpacing port="sink_out 1" spacing="0"/> <portSpacing port="sink_out 2" spacing="0"/> </process> </operator> <operator activated="true" class="subprocess" compatibility="5.3.012" expanded="true" height="76" name="GetRequestToken" width="90" x="179" y="30"> <process expanded="true"> <operator activated="true" class="extract_macro" compatibility="5.3.012" expanded="true" height="60" name="Extract Macro" width="90" x="45" y="30"> <description>Get that 64bit encoded goodness. </description> <parameter key="macro" value="token64bit"/> <parameter key="macro_type" value="data_value"/> <parameter key="attribute_name" value="token"/> <parameter key="example_index" value="1"/> <list key="additional_macros"/> </operator> <operator activated="true" class="web:get_webpage" compatibility="5.3.001" expanded="true" height="60" name="Get Page" width="90" x="112" y="120"> <description>See request properties for use of macro. If based on RFC6749 then this call would be POST with client credentials (see spec http://tools.ietf.org/html/rfc6749#section-4.4) </description> <parameter key="url" value="https://your.url.com/file.xls"/> <list key="query_parameters"/> <list key="request_properties"> <parameter key="Authorization" value="Basic %{token64bit}"/> </list> </operator> <connect from_port="in 1" to_op="Extract Macro" to_port="example set"/> <connect from_op="Get Page" from_port="output" to_port="out 1"/> <portSpacing port="source_in 1" spacing="0"/> <portSpacing port="source_in 2" spacing="0"/> <portSpacing port="sink_out 1" spacing="0"/> <portSpacing port="sink_out 2" spacing="0"/> </process> </operator> <connect from_op="Credentials" from_port="out 1" to_op="GetRequestToken" to_port="in 1"/> <connect from_op="GetRequestToken" from_port="out 1" to_port="result 1"/> <portSpacing port="source_input 1" spacing="0"/> <portSpacing port="sink_result 1" spacing="0"/> <portSpacing port="sink_result 2" spacing="0"/> </process> </operator></process>