When building templates from scratch, it is always better to know what data is available to you. In the first sections of the help manual on templates, you were explained that a data input file is merged with a word document containing tags to dynamically generated an output. The EPC uses a JSON file as a data input file. If you compare an existing template to the JSON, you will notice that the tags match exactly with the attributes within the JSON. This means that building a template is simply taking the attribute name in the JSON, enclosing it in curly braces and adding a layer of logic and formatting.
List of Requests
To obtain the data input file, paste the following URLs directly into your browser. You will get the data input file in a raw JSON format.
For most URLs:
- Replace the first ID (the long string of letters and numbers separated by dashes) by the ID of the object you want to obtain the payload.
- Replace the second ID by the ID of a valid template.
- For Generated from Template, replace the ID with the ID of the Generated from Template document
|Generated from Template||https://example.interfacing.com/api/v1/document/documents/11AA111A-A111-111A-11AA-AA111AA1A111/templater-payload?draft=true|
|draft||To obtain the payload of the published version of the object, set draft to true. To obtain the latest version, set draft to false.|
|language||To obtain the payload of the object in a specific language, set language to the 2 letter ISO2 language code.|
|includeChildren||To obtain the payload of the object and all its sub items, set includeChildren to true. To obtain only the object without sub items, set it to false.|
|types||To filter the payload to obtain only items of a certain type, add or remove types (&types=[OBJECT_TYPE]). This filter only applies to the Organization, Performance and Master Data modules.|
Alternative method of obtaining payloads
An alternative to copy/pasting the URL into your browser from the list in the help manual is to do via the Google Chrome DevTools (or any other tool that can intercept network requests)
1. Navigate to the module you want the data input file for
2. Open up the Google DevTools by pressing the F12 key on your keyboard. Alternatively, click on your browser options > More Tools > Developer Tools
3. In the Developer Tools, navigate to the Network tab
4. In the EPC, generate a document by selecting any template in the prompt. The purpose is to intercept a request in order to look at the data input file.
5. Back in the Developer Tools, search for a POST request that starts with “book?” (“sop?” for Generated from Template}
6. Click on the POST request. A window to the right side of the tool will appear. Under the “Headers” tab, copy and paste the Request URL into your browser and change “book” to “templater-payload” in the address bar of your URL (see request table above)
After copying the URL in your browser, the result is a raw unformatted JSON file. To make the format easily readable, there are a variety of options:
1. Download the JSON formatter extension directly on your browser (for Google Chrome)
2. Copy paste the entire JSON and paste it in an online JSON viewer
3. Copy paste the entire JSON into an IDE that can format JSON into a readable format