Instantly share code, notes, and snippets.

Embed
What would you like to do?
1) User navigates to location targeting
2) User clicks on the browse button in zip code targeting
3) User selects a file and clicks open
UI makes API call
POST /api/v2.0/strategies/947508/target_postcodes
Payload
------WebKitFormBoundaryVleV4FL5cW8u0LDn
Content-Disposition: form-data; name="restriction"
INCLUDE
------WebKitFormBoundaryVleV4FL5cW8u0LDn
Content-Disposition: form-data; name="validate_only"
1
------WebKitFormBoundaryVleV4FL5cW8u0LDn
Content-Disposition: form-data; name="ignore_errors"
1
------WebKitFormBoundaryVleV4FL5cW8u0LDn
Content-Disposition: form-data; name="active"
true
------WebKitFormBoundaryVleV4FL5cW8u0LDn
Content-Disposition: form-data; name="file"; filename="postal.csv"
Content-Type: text/csv
------WebKitFormBoundaryVleV4FL5cW8u0LDn
Content-Disposition: form-data; name=""
undefined
------WebKitFormBoundaryVleV4FL5cW8u0LDn--
Response
<?xml version='1.0' ?>
<result called_on="2015-10-07 21:06:06.192021+00">
<entities count="3" start="0">
</entities>
<errors>
</errors>
<status code="ok" />
</result>
4) User clicks save strategy
UI makes API call
POST /api/v2.0/strategies/947508/target_postcodes
Payload
------WebKitFormBoundary3htsoYav1Q05OZXZ
Content-Disposition: form-data; name="restriction"
INCLUDE
------WebKitFormBoundary3htsoYav1Q05OZXZ
Content-Disposition: form-data; name="validate_only"
0
------WebKitFormBoundary3htsoYav1Q05OZXZ
Content-Disposition: form-data; name="ignore_errors"
1
------WebKitFormBoundary3htsoYav1Q05OZXZ
Content-Disposition: form-data; name="active"
true
------WebKitFormBoundary3htsoYav1Q05OZXZ
Content-Disposition: form-data; name="file"; filename="postal.csv"
Content-Type: text/csv
------WebKitFormBoundary3htsoYav1Q05OZXZ
Content-Disposition: form-data; name=""
undefined
------WebKitFormBoundary3htsoYav1Q05OZXZ--
Response
<?xml version='1.0' ?>
<result called_on="2015-10-07 21:06:06.192021+00">
<entities count="3" start="0">
</entities>
<errors>
</errors>
<status code="ok" />
</result>
5) User refreshes the location targeting page for strategy
UI makes API call
GET /api/v2.0/strategies/947508/target_values?currentTime=1444252114621&full=*&partial=1
Response
<?xml version='1.0' ?>
<result>
<dimension id="2018508" code="USZC" count="3">
<entities operator="OR" set="INCLUDE">
<entity name="us10008" id="4973" type="target_value">
<prop name="target_dimension_id" value="18" />
<prop name="name" value="us10008" />
<prop name="value" value="102088" />
<prop name="code" value="us-10008" />
<prop name="is_targetable" value="1" />
</entity>
<entity name="us10002" id="18604" type="target_value">
<prop name="target_dimension_id" value="18" />
<prop name="name" value="us10002" />
<prop name="value" value="115719" />
<prop name="code" value="us-10002" />
<prop name="is_targetable" value="1" />
</entity>
<entity name="us10004" id="12108" type="target_value">
<prop name="target_dimension_id" value="18" />
<prop name="name" value="us10004" />
<prop name="value" value="109223" />
<prop name="code" value="us-10004" />
<prop name="is_targetable" value="1" />
</entity>
</entities>
</dimension>
<entities count="0" set="partial">
</entities>
<status code="ok" />
</result>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment