Why do you name it macro ?
Maybe you mean MAC routine ?

I highly recommend to read this tutorial about CacheObjectScript

usually you can call routine by simple command

do ^routine

but sometime you need to call directly to concrete label in that routine

do label^routine()

but in this case if you use curly brace style, you should public such method in routine

label() public {
 write "Hello World!"
​}

or in old style

label()
 write "Hello world!"
 quit

So, you had to start with such explanation.

Well, does not matter what do you set in Accept header, if you don't use it by yourself. Like, you should check incoming content type and send an error if it is not accepted. This Header change nothing in incoming data,  if data was sent in another format.

To read data, you should know that %request has three different ways for getting data. You have already known in %request.Content, which usually contains binary streams. Then %request.MimeData, and %request.Data, it is a Multidimensional properties, and %request has some getters for them, %request.GetMimeData and %request.Get. MimeData, needs when client send data in multipart mime format, such as several files or so on. And %request.Data, in all most cases, and you should look at this property and method %request.Get("somename")

If you use %CSP.REST, you can set needed ContentType in any called method

XData UrlMap
{
<Routes>
  <Route Url="/text" Method="GET" Call="GetText" Cors="false" />
</Routes>
}

ClassMethod GetText() 
{
    set %response.ContentType="text/plain"
    
    write "test"
    
    quit $$$OK
}

and test

➜  ~ curl -v http://localhost:57774/api/app/text
*   Trying ::1...
* Connected to localhost (::1) port 57774 (#0)
> GET /api/ambulance/text HTTP/1.1
> Host: localhost:57774
> User-Agent: curl/7.49.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 17 Aug 2016 17:54:28 GMT
< Server: Apache
< CACHE-CONTROL: no-cache
< EXPIRES: Thu, 29 Oct 1998 17:04:19 GMT
< PRAGMA: no-cache
< CONTENT-LENGTH: 4
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host localhost left intact
test%

Macro is $$$. Anyway, a little excerpt from documentation  

$
 

Dollar sign (36): Intrinsic (system) function prefix: $name(parameters).

Special variable prefix: $name.

$Znnn (a name beginning with $Z) can be a user-defined function or special variable defined using %ZLANG language extension library. It can also be an intrinsic (InterSystems supplied) function or special variable.

Regular expression end of string anchor; for example, (USA)$.

In ZBREAK debugging, a single-step breakpoint.

As first character at terminal prompt, load interactive subshell.

$$
 

Double dollar sign: Extrinsic (user-written) function prefix: $$name(parameters). $$ is returned by $STACK when context was established by an extrinsic function reference.

Prefix to a routine name to directly invoke that routine.

$$$ Triple dollar sign: Macro invocation prefix.

Unfortunately in times when web-applications prevail other types of applications this approach is cannot be widely used. This way can't be used directly in CSP, because of by default any session could be joined to any process, but Procces-private globals is not session-provite globals. And If you need to have such functionality with CSP, you should use Preserve sessions or use something like Sessions-private global, something like this

^CacheTemp.SomeTableD($select($isobject($get(%session)):%session.SessionId,1:$job))

Good article, but unfortunately I don't see the answer for last part for the question "How can I minimize the phenomena?"

So, in my practise, such behavior, in most cases related with some application's buffer globals, or logging globals. And mostly  we don't need in this journal, because it is not important part of our data, and we should not spend important resources for doing this. And we can cut off journalling for such globals. There are some ways to do it: 

  • Remap such globals to another database with disabled journaling. But this way has some exceptions, any changes in transactions, should be journaled in any way.
  • Use ENABLE^%NOJRN to disable journaling non-transact changes, and return back with DISABLE^%NORJN.
  • Remap to database CACHETEMP, which disabled for all changes, even in transaction.