Article

Formatting Strings

Learn how to format strings to pass to the API client.

Overview

When using command-line utilities to pass a string to the API client, enclose the string in single quotes to treat the text literally. When you enclose a string in double quotes, you need to escape certain ASCII characters (for example, the $ character).

This example uses single quotes:

alert-body='Big Company is acquiring Smaller Company for $2.5 billion.'

This example shows the result of using single quotes:

"alertBody": "Big Company is acquiring Smaller Company for $2.5 billion."

This example uses double quotes incorrectly:

alert-body="Big Company is acquiring Smaller Company for $2.5 billion."

This example shows the result of using double quotes incorrectly:

"alertBody": "Big Company is acquiring Smaller Company for .5 billion."

This example correctly uses double quotes with an escape character:

alert-body="Big Company is acquiring Smaller Company for \$2.5 billion."

This example shows the result of using double quotes with an escape character:

"alertBody": "Big Company is acquiring Smaller Company for $2.5 billion."

See Also

Essentials

Getting Ready to Publish and Manage Your Articles

Get set up for using the Apple News API.

About the News Security Model

Learn how the Apple News API authenticates clients, authorizes your news channel, and enforces confidentiality.

About Apple News API Field Types

Understand the standard field types used in the Apple News API.