10/6/21, 11:58 PM Knowledge Article
Initiate a request along with
attachment by consuming BMC Digital
Workplace Catalog REST API
Title Initiate a request along with attachment by consuming BMC Digital Workplace Catalog REST API
URL Name Initiate-a-request-along-with-attachment-by-consuming-BMC-Digital-Workplace-Catalog-REST-API
Summary Initiate a request along with attachment by consuming BMC Digital Workplace Catalog REST API
Visible to Partner
Visible In Internal
App
Visible In Public
Knowledge Base
Visible to
Customer
Article Guidelines Knowledge Article Quality Guidelines
Internal Only No
Unpublish
Prevention Reason
Value
Visibility - Partner
Only
Article Number 000201730
Has Attachment
TSA Info
This knowledge article is available to all
Article Type Knowledge
Helper
Product BMC Digital Workplace Advanced
Product Version 19.11.00
Component
Component
Version
Applies to
[Link] 1/7
10/6/21, 11:58 PM Knowledge Article
Question How to submit a request along with attachment using Digital Workplace Advanced REST API
Answer This knowledge article may contain information that does not apply to version 21.05 or later which runs in
a container environment. Please refer to Article Number 000385088 for more information about
troubleshooting BMC products in containers.
This article will guide you through step by step procedure to submit a request along with an
attachment using the Digital Workplace Catalog REST API.
Base URI and Default Headers
The following base URI (example) is used for calling the BMC Digital Workplace
Catalog server.
[Link]
Unless an API endpoint requires a different header, the following header is required
for all requests:
default-bundle-scope: myit-sb
Content-Type: application/json
X-Requested-By: XMLHttpRequest
Generate Authentication Token
Log in to the application by using the users/login endpoint to generate token.
Token is valid for about 30 minutes.
This token is typically sent back and forth as a AR-JWT cookie, although it can also
be included inside the header.
Request URL (POST) : Base URI + Login API ([Link]
[Link]/api/myit-sb/users/login)
Body :
{
"id": "hannah_admin@domain_name",
"password": “password"
}
NOTE: DWPA user sync job copies Full Name, Login Name and Email Address. It does not
copy the password from ITSM. Set a password for the user by login into SB AR server using
User tool to consume endpoints API from external tools like POSTMAN.
Search service ID by Title
Retrieve serviceId by calling the endpoint /services/search
Request URL (POST) : [Link]
sb/services/search
Body :
{ "title": "Create Service Request Item"}
Response :
[Link] 2/7
10/6/21, 11:58 PM Knowledge Article
Initiate a request along with attachment
1. Initiate a request by serviceId.
Request URL (POST) : [Link]
sb/request
Body :
{"serviceId" : "10301"}
Response :
2. Get service request questionnaire by using the requestId in the URL.
Request URL (GET) : [Link]
sb/request/10410/questionnaire
Response :
[Link] 3/7
10/6/21, 11:58 PM Knowledge Article
3. Send an answer to a question.
Request URL (POST) : [Link]
sb/services/10410/questionnaire/answers
Body :
{
"questionnaireId" : "10204",
"questionId" : "a78f17ee-e4ef-a729-98c3-27c78f12e391",
"answers" : ["Answer from REST API"],
"serviceRequestId" : "10410"
}
Response (if all okay) :
{}
Similarly, all required questions must be answered with separate API call.
4. Prepare an attachment
Request URL (POST) : [Link]
sb/content
Additional header :
Content-Disposition : form-data; name="file"; filename="[Link]“
Body :
Under from-data, set the key to “file” and select the file by browsing the file in
“value”
Response :
{ "contentId": "AGGA49C8EC0WUAQEK1GEQDMKGSUDE3"}
This endpoint will return the contentId which will be used to make a POST call to
submit the attachment.
5. Submit an attachment
Request URL (POST) : [Link]
sb/services/10410/questionnaire/answers
Body :
{
"questionnaireId" : "10204",
"questionId" : "d4e8b5c7-1525-0356-fa61-c923499f07a9",
"answers" : ["AGGA49C8EC0WUAQEK1GEQDMKGSUDE3"],
"serviceRequestId" : "10410"
}
Note : contentId returned in previous call is used in the answer.
Response (if all okay) :
{}
6. Submit the Order
Request URL (POST) : [Link]
sb/orders
Body :
[Link] 4/7
10/6/21, 11:58 PM Knowledge Article
{ "requests" : [{"id" : "10410"}] }
Response :
Initiate a request with all the answers
1. Initiate a request
Request URL (POST) : [Link]
sb/requests
Body :
{
"serviceId": "10301",
"requestForUserIds": ["dwpadmin"],
"questions": [{
"answers" : ["Answer from REST API"],
"questionId" : "a78f17ee-e4ef-a729-98c3-27c78f12e391"
},
{
"answers" : ["4-Low"],
"questionId" : "bc3bdd3c-b51f-e82c-62b8-fd7c4a2d2b06"
},
{
"answers" : ["4-Minor/Localized"],
"questionId" : "ea74a6c0-7536-d212-de15-34daa7547bb7"
},
{
"answers" : ["AGGA49C8EC0WUAQEDQE3QDFZFBPC1I"],
"questionId" : "d4e8b5c7-1525-0356-fa61-c923499f07a9"
}]
}
NOTE: ‘questions’ is an optional array field and if included, you must provide at
least one *questionId* and the associated answer.
2. Submit the order by calling the end point myit-sb/orders (similar to the last topic)
Initiate a request on behalf
1. Initiate a request with impersonated-user-id header
Request URL (POST) : [Link]
Additional Header :
impersonated-user-id : dwpadmin@[Link] <<LoginID@[Link]>>
Body :
{
"serviceId" : "10301",
"requestedForIds" : ["dwpadmin"],
"quantity" : "1"
}
Response :
[Link] 5/7
10/6/21, 11:58 PM Knowledge Article
2. Send all the answers and submit the order by calling the endpoint myit-sb/orders
Partner
Instructions
Marked for
Deletion
Unpublish
Prevention Reason
Internal Comment
KARecordType FAQ/Procedural
ServiceCloud Data
Load
Source
Source Id
R&D Product Line DSOM
R&D Product
DWP
Family
Product Category DWP/LOB APPS ON PREM
Submitted by Chetan Singh RK
Submission
20/2/2020 7:04 pm
Date/Time
Old Article Number 000184593
Old Article Type sc_FAQ_Procedural__kav
Created By Chetan Singh RK
Article Created By Chetan Singh RK
[Link] 6/7
10/6/21, 11:58 PM Knowledge Article
Created Date 10/7/2021 3:48 pm
Boost Context
[Link] 7/7