
{
"info": {
"_postman_id": "43b9377d-9355-4e0b-bd4f-044c9deb6d9d",
"name": "print",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Step1 Get Token",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.collectionVariables.set(\"bearToken\",\"Bearer \".concat(pm.response.json().access_token))"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{printclientsecret}}",
"type": "string"
},
{
"key": "username",
"value": "{{printclientkey}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "client_credentials",
"type": "default"
}
]
},
"url": {
"raw": "{{printtokenurl}}",
"host": [
"{{printtokenurl}}"
]
}
},
"response": []
},
{
"name": "Step2 Get PrintQ",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.collectionVariables.set(\"printQ\",pm.response.json()[0].qname)"
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
"pm.request.addHeader(\"Authorization\",pm.collectionVariables.get(\"bearToken\"));"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "clientId",
"value": "{{printclientkey}}",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "{{printtokenurl}}",
"type": "string"
},
{
"key": "grant_type",
"value": "client_credentials",
"type": "string"
},
{
"key": "clientSecret",
"value": "{{printclientsecret}}",
"type": "string"
},
{
"key": "tokenName",
"value": "printkey",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
},
{
"key": "scope",
"value": "",
"type": "string"
},
{
"key": "tokenType",
"value": "Bearer",
"type": "string"
},
{
"key": "client_authentication",
"value": "header",
"type": "string"
},
{
"key": "password",
"value": "Guoq07@5",
"type": "string"
},
{
"key": "username",
"value": "jacky.liu02@sap.com",
"type": "string"
},
{
"key": "headerPrefix",
"value": "Bearer",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{printserviceurl}}/qm/api/v1/rest/queues",
"host": [
"{{printserviceurl}}"
],
"path": [
"qm",
"api",
"v1",
"rest",
"queues"
]
}
},
"response": []
},
{
"name": "Step3 Upload Document",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if(pm.response.to.have.status(201)){",
" pm.collectionVariables.set(\"dmId\",pm.response.text());",
" pm.collectionVariables.set(\"fileName\",pm.request.body.formdata.all()[0].src.split(\"/\").last());",
"}",
" "
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
"pm.request.addHeader(\"Authorization\",pm.collectionVariables.get(\"bearToken\"));"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept-encoding": true,
"connection": true,
"accept": true
}
},
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "grant_type",
"value": "client_credentials",
"type": "string"
},
{
"key": "client_authentication",
"value": "header",
"type": "string"
},
{
"key": "clientId",
"value": "{{printclientkey}}",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "{{printtokenurl}}",
"type": "string"
},
{
"key": "clientSecret",
"value": "{{printclientsecret}}",
"type": "string"
},
{
"key": "tokenName",
"value": "printkey",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
},
{
"key": "scope",
"value": "",
"type": "string"
},
{
"key": "tokenType",
"value": "Bearer",
"type": "string"
},
{
"key": "password",
"value": "Guoq07@5",
"type": "string"
},
{
"key": "username",
"value": "jacky.liu02@sap.com",
"type": "string"
},
{
"key": "headerPrefix",
"value": "Bearer",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "If-None-Match",
"value": "*",
"type": "default"
},
{
"key": "scan",
"value": "true",
"type": "default"
},
{
"key": "Accept",
"value": "application/json",
"type": "default"
},
{
"key": "DataServiceVersion",
"value": "2.0",
"type": "default"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "file",
"type": "file",
"src": "/Users/I501000/Downloads/q4.jpg"
}
]
},
"url": {
"raw": "{{printserviceurl}}/dm/api/v1/rest/print-documents",
"host": [
"{{printserviceurl}}"
],
"path": [
"dm",
"api",
"v1",
"rest",
"print-documents"
]
}
},
"response": []
},
{
"name": "Step4 Create Print Task",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
"pm.request.addHeader(\"Authorization\",pm.collectionVariables.get(\"bearToken\"));"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "grant_type",
"value": "client_credentials",
"type": "string"
},
{
"key": "client_authentication",
"value": "header",
"type": "string"
},
{
"key": "clientId",
"value": "{{printclientkey}}",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "{{printtokenurl}}",
"type": "string"
},
{
"key": "clientSecret",
"value": "{{printclientsecret}}",
"type": "string"
},
{
"key": "tokenName",
"value": "printkey",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
},
{
"key": "scope",
"value": "",
"type": "string"
},
{
"key": "tokenType",
"value": "Bearer",
"type": "string"
},
{
"key": "password",
"value": "Guoq07@5",
"type": "string"
},
{
"key": "username",
"value": "jacky.liu02@sap.com",
"type": "string"
},
{
"key": "headerPrefix",
"value": "Bearer",
"type": "string"
}
]
},
"method": "PUT",
"header": [
{
"key": "If-None-Match",
"value": "*",
"type": "default"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"numberOfCopies\": 1,\n \"username\": \"test user\",\n \"qname\": \"{{printQ}}\",\n \"metadata\": {\n \"business_metadata\": {\n \"business_user\": \"user1\",\n \"object_node_type\": \"object_node_1\"\n },\n \"version\": 1.2\n },\n \"printContents\": [\n {\n \"objectKey\": \"{{dmId}}\",\n \"documentName\": \"{{fileName}}\"\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{printserviceurl}}/qm/api/v1/rest/print-tasks/{{dmId}}",
"host": [
"{{printserviceurl}}"
],
"path": [
"qm",
"api",
"v1",
"rest",
"print-tasks",
"{{dmId}}"
],
"query": [
{
"key": "itemId",
"value": "2349add8-d48e-46ee-91d6-e7bb98cfdbff",
"disabled": true
}
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "printtokenurl",
"value": "https://apjcoe-x66183k9.authentication.eu10.hana.ondemand.com/oauth/token",
"type": "default"
},
{
"key": "printclientkey",
"value": "sb-6aa6869e-be8|print-app!b46384",
"type": "default"
},
{
"key": "printclientsecret",
"value": "Dw8LMo=",
"type": "default"
},
{
"key": "printserviceurl",
"value": "https://api.eu10.print.services.sap",
"type": "default"
},
{
"key": "dmId",
"value": "",
"type": "default"
},
{
"key": "fileName",
"value": ""
},
{
"key": "printQ",
"value": ""
},
{
"key": "bearToken",
"value": ""
}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
10 | |
8 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 |