{
  "info": {
    "_postman_id": "77ed7d84-cfe5-4f21-aef3-30ad622cefd1",
    "name": "WiFi Calls - Symfony Blog CMS API",
    "description": "Blog API port using the app OpenSSL AES-256-CBC cryptor and existing General Settings key/IV. Public bodies are raw Base64 ciphertext; admin requests use Blog-only bearer tokens and plain JSON. Configure baseUrl and credentials locally.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://localhost:8080/api",
      "type": "string"
    },
    {
      "key": "adminEmail",
      "value": "admin@example.com",
      "type": "string"
    },
    {
      "key": "adminPassword",
      "value": "",
      "type": "string"
    },
    {
      "key": "adminToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "postId",
      "value": "",
      "type": "string"
    },
    {
      "key": "postSlug",
      "value": "",
      "type": "string"
    },
    {
      "key": "importFilePath",
      "value": "/absolute/path/to/blog-export-single.json",
      "type": "string"
    },
    {
      "key": "cryptoPlaintext",
      "value": "{\"message\":\"Blog crypto smoke test\"}",
      "type": "string"
    },
    {
      "key": "cryptoCiphertext",
      "value": "",
      "type": "string"
    },
    {
      "key": "publicCiphertext",
      "value": "",
      "type": "string"
    },
    {
      "key": "mediaData",
      "value": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAusB9Y9JVoAAAAAASUVORK5CYII=",
      "type": "string"
    },
    {
      "key": "featuredMediaId",
      "value": "",
      "type": "string"
    },
    {
      "key": "mediaUrl",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Public API",
      "item": [
        {
          "name": "List posts — encrypted",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/v1/posts?page=1&perPage=12"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Returns an encrypted public response', () => pm.response.to.have.status(200));",
                  "pm.expect(pm.response.headers.get('X-Blog-Encryption')).to.eql('aes-256-cbc');",
                  "pm.expect(pm.response.text()).to.not.be.empty;",
                  "pm.collectionVariables.set('publicCiphertext', pm.response.text());"
                ]
              }
            }
          ]
        },
        {
          "name": "Get post by slug",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/v1/posts/{{postSlug}}"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Returns an encrypted post or encrypted 404', () => pm.expect(pm.response.code).to.be.oneOf([200, 404]));",
                  "pm.expect(pm.response.headers.get('X-Blog-Encryption')).to.eql('aes-256-cbc');"
                ]
              }
            }
          ]
        },
        {
          "name": "Sitemap",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/v1/sitemap"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Returns an encrypted sitemap', () => pm.response.to.have.status(200));",
                  "pm.expect(pm.response.headers.get('X-Blog-Encryption')).to.eql('aes-256-cbc');"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Admin API",
      "item": [
        {
          "name": "Login",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{adminEmail}}\",\n  \"password\": \"{{adminPassword}}\"\n}"
            },
            "url": "{{baseUrl}}/admin/auth/login"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Login succeeds', () => pm.response.to.have.status(200));",
                  "const body = pm.response.json();",
                  "pm.expect(body.ok).to.eql(true);",
                  "pm.collectionVariables.set('adminToken', body.token);"
                ]
              }
            }
          ]
        },
        {
          "name": "Current admin",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/admin/auth/me"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Returns the authenticated editor', () => { pm.response.to.have.status(200); pm.expect(pm.response.json().user).to.have.property('role'); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Create draft",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"intent\": \"draft\",\n  \"values\": {\n    \"title\": \"Staging API smoke-test post\",\n    \"slug\": \"staging-api-smoke-test-post\",\n    \"excerpt\": \"Created through Postman. Delete after verification.\",\n    \"content\": \"<p>This draft verifies the CMS API.</p>\",\n    \"tags\": [\n      \"staging\",\n      \"api\"\n    ]\n  }\n}"
            },
            "url": "{{baseUrl}}/admin/blogs"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Draft created', () => pm.response.to.have.status(201));",
                  "const post = pm.response.json().data;",
                  "pm.collectionVariables.set('postId', post.id);",
                  "pm.collectionVariables.set('postSlug', post.slug);"
                ]
              }
            }
          ]
        },
        {
          "name": "Create draft with App Store CTA",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"intent\": \"draft\",\n  \"values\": {\n    \"title\": \"CTA App Store test\",\n    \"slug\": \"cta-app-store-test\",\n    \"content\": \"<p>CTA test content.</p>\",\n    \"ctaEnabled\": true,\n    \"ctaTitle\": \"Need a Second Phone Number? Start Now.\",\n    \"ctaDescription\": \"Stay professional and protect your privacy.\",\n    \"ctaButtonText\": \"Download on the App Store\",\n    \"ctaButtonUrl\": \"https://apple.co/44uoXf0\",\n    \"ctaButtonStyle\": \"APP_STORE\"\n  }\n}"
            },
            "url": "{{baseUrl}}/admin/blogs"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Saves APP_STORE CTA style', () => { pm.response.to.have.status(201); pm.expect(pm.response.json().data.cta_button_style).to.eql('APP_STORE'); });"
                ]
              }
            }
          ]
        },
        {
          "name": "List blog posts",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/admin/blogs?page=1&pageSize=15"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Lists blog posts', () => { pm.response.to.have.status(200); pm.expect(pm.response.json().ok).to.eql(true); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Set post inactive",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/admin/blogs/{{postId}}/inactive"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Post is hidden from the public API', () => { pm.response.to.have.status(200); pm.expect(pm.response.json().data.is_active).to.eql(false); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Set post active",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/admin/blogs/{{postId}}/active"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Post is active again', () => { pm.response.to.have.status(200); pm.expect(pm.response.json().data.is_active).to.eql(true); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Delete post permanently — ADMIN only",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/admin/blogs/{{postId}}"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Administrator permanently deletes the post', () => { pm.response.to.have.status(200); pm.expect(pm.response.json().ok).to.eql(true); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Import JSON — dry run",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": "{{importFilePath}}",
                  "description": "Select blog-export-single.json in Postman if your client does not resolve file-path variables."
                },
                {
                  "key": "existing",
                  "value": "skip",
                  "type": "text"
                },
                {
                  "key": "dryRun",
                  "value": "1",
                  "type": "text"
                }
              ]
            },
            "url": "{{baseUrl}}/blog/admin/blogs/import-json"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Dry run is accepted', () => pm.response.to.have.status(200));",
                  "const body = pm.response.json();",
                  "pm.expect(body.ok).to.eql(true);",
                  "pm.expect(body.data.dryRun).to.eql(true);",
                  "pm.expect(body.data.summary).to.have.property('posts');"
                ]
              }
            }
          ]
        },
        {
          "name": "Import JSON — write",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": "{{importFilePath}}",
                  "description": "Use only after the dry run is correct."
                },
                {
                  "key": "existing",
                  "value": "skip",
                  "type": "text"
                },
                {
                  "key": "dryRun",
                  "value": "0",
                  "type": "text"
                }
              ]
            },
            "url": "{{baseUrl}}/blog/admin/blogs/import-json"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Import completes', () => pm.response.to.have.status(200));",
                  "const body = pm.response.json();",
                  "pm.expect(body.ok).to.eql(true);",
                  "pm.expect(body.data.dryRun).to.eql(false);"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Authors and Categories",
      "item": [
        {
          "name": "List categories for editor picker",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/admin/categories?page=1&pageSize=500&status=ACTIVE"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Returns category picker rows', () => { pm.response.to.have.status(200); pm.expect(pm.response.json().data.data).to.be.an('array'); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Create category",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Apps Reviews\",\n  \"slug\": \"apps-reviews\",\n  \"description\": \"Hands-on reviews of second number apps.\",\n  \"status\": \"ACTIVE\"\n}"
            },
            "url": "{{baseUrl}}/admin/categories"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Creates category', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('categoryId', pm.response.json().data.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "List authors for editor picker",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/admin/authors?page=1&pageSize=500&status=ACTIVE"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Returns author picker rows', () => { pm.response.to.have.status(200); pm.expect(pm.response.json().data.data).to.be.an('array'); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Create author with media URL",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Andrew Miller\",\n  \"slug\": \"andrew-miller\",\n  \"role\": \"Privacy & Security Writer\",\n  \"bio\": \"Writes about phone privacy.\",\n  \"profileImage\": \"{{mediaUrl}}\",\n  \"status\": \"ACTIVE\"\n}"
            },
            "url": "{{baseUrl}}/admin/authors"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Creates author', () => pm.response.to.have.status(201));",
                  "pm.collectionVariables.set('authorId', pm.response.json().data.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Save draft using media URL strings",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"intent\": \"draft\",\n  \"values\": {\n    \"title\": \"Image URL save test\",\n    \"slug\": \"image-url-save-test\",\n    \"content\": \"<p>Image URL validation test.</p>\",\n    \"categoryId\": \"{{categoryId}}\",\n    \"authorId\": \"{{authorId}}\",\n    \"featuredImage\": \"{{mediaUrl}}\",\n    \"featuredImageAlt\": \"Blog cover\",\n    \"ogImage\": \"{{mediaUrl}}\",\n    \"ctaImage\": \"{{mediaUrl}}\"\n  }\n}"
            },
            "url": "{{baseUrl}}/admin/blogs"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Accepts media URL strings', () => { pm.response.to.have.status(201); pm.expect(pm.response.json().data.featured_image).to.eql(pm.collectionVariables.get('mediaUrl')); });"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Blog Media",
      "item": [
        {
          "name": "Upload Base64 image",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"filename\": \"postman-sample.png\",\n  \"data\": \"{{mediaData}}\",\n  \"alt\": \"Postman Blog image\",\n  \"title\": \"Blog media smoke test\"\n}"
            },
            "url": "{{baseUrl}}/blog/admin/media"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Uploads Base64 image to Blog media storage', () => pm.response.to.have.status(201));",
                  "const body = pm.response.json();",
                  "pm.expect(body.ok).to.eql(true);",
                  "pm.expect(body.data.url).to.be.a('string').and.not.empty;",
                  "pm.collectionVariables.set('featuredMediaId', body.data.id);",
                  "pm.collectionVariables.set('mediaUrl', body.data.url);"
                ]
              }
            }
          ]
        },
        {
          "name": "Create draft with Base64 images — one API call",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"intent\": \"draft\",\n  \"values\": {\n    \"title\": \"Blog media smoke-test post\",\n    \"slug\": \"blog-media-smoke-test-post\",\n    \"excerpt\": \"Draft with a featured and inline S3 image.\",\n    \"featuredImage\": {\n      \"filename\": \"cover.png\",\n      \"data\": \"{{mediaData}}\",\n      \"alt\": \"Postman Blog cover\",\n      \"title\": \"Blog cover\"\n    },\n    \"contentImages\": [\n      {\n        \"clientId\": \"inline-1\",\n        \"filename\": \"inline.png\",\n        \"data\": \"{{mediaData}}\",\n        \"alt\": \"Postman inline image\"\n      }\n    ],\n    \"content\": \"<p>Image uploaded through the Blog create API.</p><figure><img data-blog-image-id=\\\"inline-1\\\"><figcaption>Uploaded Blog media</figcaption></figure>\",\n    \"tags\": [\n      \"staging\",\n      \"media\"\n    ]\n  }\n}"
            },
            "url": "{{baseUrl}}/admin/blogs",
            "description": "The backend uploads featuredImage and contentImages to S3, then replaces data-blog-image-id placeholders with S3 URLs."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Creates a draft and uploads Base64 images', () => pm.response.to.have.status(201));",
                  "const body = pm.response.json();",
                  "pm.expect(body.data.featured_image).to.be.a('string').and.not.empty;",
                  "pm.collectionVariables.set('postId', body.data.id);",
                  "pm.collectionVariables.set('postSlug', body.data.slug);"
                ]
              }
            }
          ]
        },
        {
          "name": "List media",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/blog/admin/media?page=1&pageSize=20"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Lists Blog media', () => pm.response.to.have.status(200));",
                  "pm.expect(pm.response.json().ok).to.eql(true);"
                ]
              }
            }
          ]
        },
        {
          "name": "Delete uploaded media",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              }
            ],
            "url": "{{baseUrl}}/blog/admin/media/{{featuredMediaId}}",
            "description": "Run only before attaching this media to a Blog post. Attached media is intentionally rejected with HTTP 409."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Deletes an unused uploaded image', () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Internal Blog Crypto — ADMIN only",
      "item": [
        {
          "name": "Encrypt plaintext",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{{cryptoPlaintext}}"
            },
            "url": "{{baseUrl}}/blog/admin/crypto/encrypt"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Encrypts with the Blog API key', () => pm.response.to.have.status(200));",
                  "pm.expect(pm.response.text()).to.not.be.empty;",
                  "pm.collectionVariables.set('cryptoCiphertext', pm.response.text());"
                ]
              }
            }
          ]
        },
        {
          "name": "Decrypt ciphertext",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{{cryptoCiphertext}}"
            },
            "url": "{{baseUrl}}/blog/admin/crypto/decrypt"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Decrypts with the Blog API key', () => pm.response.to.have.status(200));",
                  "pm.expect(pm.response.text()).to.eql(pm.collectionVariables.get('cryptoPlaintext'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Decrypt last public API response",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{adminToken}}"
              },
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{{publicCiphertext}}"
            },
            "url": "{{baseUrl}}/blog/admin/crypto/decrypt",
            "description": "Run Public API / List posts — encrypted first. This proves the public ciphertext decrypts to its original JSON."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Decrypts the stored public API response', () => pm.response.to.have.status(200));",
                  "pm.expect(JSON.parse(pm.response.text())).to.have.property('posts');"
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}
