Important Gotchas
While we wish that we could directly connect Slate to every third-party API, there are two general limitations that often force the use of middleware or scripts hosted outside of Slate.
Another important consideration is how datetime
is exported.
No Interactive Authentication
Slate's GET/POST tools do not support OAuth and other interactive authentication schemes. For example, anything that involves fetching a token in advance of the actual API call will require a script or middleware outside of Slate.
Root Elements
JSON both imported and exported from Slate expects a root element. Sometimes you can pick a "root" element somewhere in the body and walk back out.
You might wonder why Slate's output JSON has a root element of "row." We believe that Slate converts JSON to XML internally using Newtonsoft.Json.ConvertersXmlNodeConverter. However, XML doesn't have simple arrays like JSON. Therefore, you must supply an outer element name that will become the root element when the JSON array is converted to XML.
Still confused? See this Stackoverflow post, or try an online JSON to XML converter and compare the XML versions of the following:
[
{
"aid": "15454d71-0378-4b23-bea2-6e854a53c2b5",
"people_code_id": "**********",
"credits": "12.0",
"registered": "True"
},
{
"aid": "a2bd4535-c8f8-4417-b91a-0cf7c406ac37",
"people_code_id": "**********",
"credits": "0",
"registered": "False"
}
]
Vs
{
"row": [
{
"aid": "15454d71-0378-4b23-bea2-6e854a53c2b5",
"people_code_id": "**********",
"credits": "12.0",
"registered": "True"
},
{
"aid": "a2bd4535-c8f8-4417-b91a-0cf7c406ac37",
"people_code_id": "**********",
"credits": "0",
"registered": "False"
}
]
}
Milliseconds
When exporting JSON, be aware that exports with an underlying datetime
type will truncate (not round) milliseconds by default. To preserve milliseconds, set a Date/Time format mask like 'O'
or 'yyyy-MM-dd HH:mm:ss.fff'
.
No Comments