While testing, I see I can easily set %session.Data to hold data I want to preserve.  

No problem! I thought you were having issues with that part.

how, on my next API call can I use that session  

You just need to supply the cookies CSPSESSIONID and CSPWSERVERID. With that you'll have the same session. In browsers (and I think in postman) that's automatic, so you don't have to do anything. It should work out of the box as long as you have UseSession set to 1.

From the documentation (even better docs):

1. Open the spec class.

2. Add

Parameter UseSession As BOOLEAN = 1;

3. Recompile the spec class.

4. Now your disp class has the same parameter and you can use sessions in your impl class.

If you need a larger change than adding a parameter to a dispatcher class, do this (docs):

1. Create a custom subclass of %CSP.REST, i.e. test.REST.
2. Modify your swagger spec by adding x-ISC_DispatchParent:

  "info":{
    "version":"1.0.0",
    "x-ISC_DispatchParent":"test.REST",

3. Recompile.

Now your disp class extends test.REST and you can modify anything there.

Pythonic way is to use with. In that case close is automatic as soon as we get outsude of the context:

ClassMethod ReadFileUsingPython(pFile As %String) [ Language = python ]
{
  from datetime import datetime
  import iris
  time1 = datetime.timestamp(datetime.now())
  print(time1)
  if pFile=="":
    raise Exception("filename is required.")

  with open(pFile,"r", encoding="utf-8", errors="ignore") as file:
    log = iris.cls('otw.log.Log')
    for line in file:
      status = log.ImportLine(line)

  time2 = datetime.timestamp(datetime.now())
  print(time2)
  print("Execution time: ",(time2-time1))
}

Also you can simplify your code:

ClassMethod ReadFileUsingPython(pFile As %String) [ Language = python ]
{
  from datetime import datetime
  import iris
  time1 = datetime.timestamp(datetime.now())
  print(time1)
  if pFile=="":
    raise Exception("filename is required.")

  file = open(pFile,"r", encoding="utf-8", errors="ignore")
  log = iris.cls('otw.log.Log')
  for line in file:
    status = log.ImportLine(line)

  time2 = datetime.timestamp(datetime.now())
  print(time2)
  print("Execution time: ",(time2-time1))
}

Download Caché 2018.1.7 from the WRC - it will be able to mount CACHE.DAT from Caché 2012.1 or restore a backup from it.

Do you have this line:

   <!-- Get info about pivot variables-->
   <Route Url="/PivotVariables/:Cube" Method="GET" Call="WritePivotVariablesForCube"/>

in the UrlMap of the MDX2JSON.REST class?