Last active
August 12, 2020 06:03
-
-
Save CryDeTaan/0e97472285c69c7199c6a77b1c9fad40 to your computer and use it in GitHub Desktop.
Laravel Sanctum API Postman Collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "5f8e6b13-11e0-402e-8aab-2fef95c7fb42", | |
"name": "Laravel Sanctum API", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "Register", | |
"protocolProfileBehavior": { | |
"disabledSystemHeaders": {} | |
}, | |
"request": { | |
"method": "POST", | |
"header": [ | |
{ | |
"key": "Accept", | |
"type": "text", | |
"value": "application/json" | |
}, | |
{ | |
"key": "X-XSRF-TOKEN", | |
"type": "text", | |
"value": "{{xsrf-cookie}}" | |
} | |
], | |
"body": { | |
"mode": "formdata", | |
"formdata": [ | |
{ | |
"key": "name", | |
"value": "admin", | |
"type": "text" | |
}, | |
{ | |
"key": "email", | |
"value": "[email protected]", | |
"type": "text" | |
}, | |
{ | |
"key": "password", | |
"value": "password", | |
"type": "text" | |
}, | |
{ | |
"key": "password_confirmation", | |
"value": "password", | |
"type": "text" | |
} | |
] | |
}, | |
"url": { | |
"raw": "{{base_url}}/register", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"register" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Login", | |
"request": { | |
"method": "POST", | |
"header": [ | |
{ | |
"key": "Accept", | |
"value": "application/json", | |
"type": "text" | |
}, | |
{ | |
"key": "X-XSRF-TOKEN", | |
"value": "{{xsrf-cookie}}", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "formdata", | |
"formdata": [ | |
{ | |
"key": "email", | |
"value": "[email protected]", | |
"type": "text" | |
}, | |
{ | |
"key": "password", | |
"value": "password", | |
"type": "text" | |
} | |
] | |
}, | |
"url": { | |
"raw": "{{base_url}}/login", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"login" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Logout", | |
"request": { | |
"method": "POST", | |
"header": [ | |
{ | |
"key": "Accept", | |
"type": "text", | |
"value": "application/json" | |
}, | |
{ | |
"key": "X-XSRF-TOKEN", | |
"type": "text", | |
"value": "{{xsrf-cookie}}" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/logout", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"logout" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "User", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Accept", | |
"type": "text", | |
"value": "application/json" | |
}, | |
{ | |
"key": "Referer", | |
"value": "{{host}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/user", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"user" | |
] | |
} | |
}, | |
"response": [] | |
} | |
], | |
"event": [ | |
{ | |
"listen": "prerequest", | |
"script": { | |
"id": "f7d5386d-3357-4d9d-8e6e-26804e2c1126", | |
"type": "text/javascript", | |
"exec": [ | |
"pm.sendRequest({", | |
" url: pm.collectionVariables.get('base_url')+'/sanctum/csrf-cookie',", | |
" method: 'GET'", | |
"}, function (error, response, {cookies}) {", | |
" if (!error){", | |
" pm.collectionVariables.set('xsrf-cookie', cookies.get('XSRF-TOKEN'))", | |
" }", | |
"})" | |
] | |
} | |
}, | |
{ | |
"listen": "test", | |
"script": { | |
"id": "612a37e1-1658-4d9e-b697-c2f41dfccc89", | |
"type": "text/javascript", | |
"exec": [ | |
"" | |
] | |
} | |
} | |
], | |
"variable": [ | |
{ | |
"id": "2c9790e6-ed28-4f97-a86b-feb2f48f822d", | |
"key": "host", | |
"value": "app.test:3000" | |
}, | |
{ | |
"id": "70214a25-9749-4d3b-b697-e3c9c1b5579f", | |
"key": "base_url", | |
"value": "http://api.app.test" | |
}, | |
{ | |
"id": "033c6eaa-d133-477a-b72a-5786ba6a064f", | |
"key": "xsrf-cookie", | |
"value": "" | |
} | |
], | |
"protocolProfileBehavior": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment