Create mock blog post

POST {{baseUrl}}/post

This request shows an example of generating longer-form content, in this case, a blog post, and transforming mock data as part of a pre-request script.

In the body, we use dynamic variables to generate a name, a short set of words as a title, a 'slug' (URL-safe textual identifier like dolores-est-iusto), and a post summary.

In the pre-request script, we generate some paragraphs of text using pm.variables.replaceIn. We then transform this text to make it JSON-safe by replacing newline characters with escaped newline characters and setting the result to a variable we can reference in the body.

Request Body

{"author"=>"{{$randomUserName}}", "title"=>"{{$randomLoremWords}}", "slug"=>"{{$randomLoremSlug}}", "summary"=>"{{$randomLoremSentences}}", "body"=>"{{blogPostContent}}"}