[JIRA Connector] How to make this work with JSON input and attachment

[JIRA Connector] How to make this work with JSON input and attachment

  
Forge Component
(14)
Published on 2017-04-27 by Labs
14 votes
Published on 2017-04-27 by Labs

Hi Team,

I tried to develop one new service as per the IssueAddAttachment action in consumed API .

My API is like this.

POST /rest/bfo/mycase/2.0/cases

Authorization: Bearer 6f0aab651234e57b4ba4567da3f47a

Content-Type: multipart/form-data; boundary="boundary_string"

X-SE-IFW-BFOAccessToken: 00D17000000A1E7!ARwAQAp0ALjoR_.X6Q9GVFcHUxOxWkT0cGvZnTnzNISZMbzihsFyWWxTCYmzSEhxplVviv8j0dQpY.jCa2aFxBRNpZ67M3Gf

X-SE-IFW-ApplicationName: CCCAPP

X-SE-IFW-CountryCode: FR

X-SE-IFW-LanguageCode: EN

X-SE-IFW-RequestId: 10001

--boundary_string

Content-Disposition: form-data; name="entity_document";

Content-Type: application/json

{
 "portalId": "Meter Insights",
 "sendAutoGeneratedEmail": "false",
 "caseInformation": {

      "accountId": "0011100001OfIAeAAN",
 "subject": "RegisterCaseTesting",
 "customerRequest": "Testing",
 "category": "Pricing and Availability",
 "reason": "Comments",
 "severity": "Normal",
 "status": "New",
 "priority": "Normal",
 "origin": "Phone",
 "type": "Feature Request",
 "CCTeam": "CCC-MobileApp",
 "CCCountryCode": "FR",
 "callBackNumber": "7410258963",
 "productReference": "Prod133",
 "materialDescription": "MD0032",
 "symptom": "working"
 },
 "caseOwner": [
 "SESA56238"
 ],
 "webInformation": {
 "name": "saleha",
 "emailAddress": "saleha_saheen@thbs.com",
 "phone": "9945678432",
 "company": "Thbs",
 "country": "Japan",
 "language": "Japanese",
 "jobTitle": "Software Engineer"
 },
 "additionalDetails": {
 "quantity": "1.0",
 "serialNumbers": "1234",
 "dateCodes": "20151212",
 "operatingSystem": "Windows8",
 "softwareVersion": "1.0"
 }
 }

--boundary_string

Content-Type: text/plain

Content-Disposition: form-data; name="Body"; filename="api-test.txt"

Binary data of the file goes here

--boundary_string--

Can you please advise me what logic I should write in OnBeforeRequest so that I can consume this API? It would be nice if show some demo.

Thanks and Regards,

Suraj Borade

Suraj Borade wrote:

Hi Team,

I tried to develop one new service as per the IssueAddAttachment action in consumed API .

My API is like this.

POST /rest/bfo/mycase/2.0/cases

Authorization: Bearer 6f0aab651234e57b4ba4567da3f47a

Content-Type: multipart/form-data; boundary="boundary_string"

X-SE-IFW-BFOAccessToken: 00D17000000A1E7!ARwAQAp0ALjoR_.X6Q9GVFcHUxOxWkT0cGvZnTnzNISZMbzihsFyWWxTCYmzSEhxplVviv8j0dQpY.jCa2aFxBRNpZ67M3Gf

X-SE-IFW-ApplicationName: CCCAPP

X-SE-IFW-CountryCode: FR

X-SE-IFW-LanguageCode: EN

X-SE-IFW-RequestId: 10001

--boundary_string

Content-Disposition: form-data; name="entity_document";

Content-Type: application/json

{
 "portalId": "Meter Insights",
 "sendAutoGeneratedEmail": "false",
 "caseInformation": {

      "accountId": "0011100001OfIAeAAN",
 "subject": "RegisterCaseTesting",
 "customerRequest": "Testing",
 "category": "Pricing and Availability",
 "reason": "Comments",
 "severity": "Normal",
 "status": "New",
 "priority": "Normal",
 "origin": "Phone",
 "type": "Feature Request",
 "CCTeam": "CCC-MobileApp",
 "CCCountryCode": "FR",
 "callBackNumber": "7410258963",
 "productReference": "Prod133",
 "materialDescription": "MD0032",
 "symptom": "working"
 },
 "caseOwner": [
 "SESA56238"
 ],
 "webInformation": {
 "name": "saleha",
 "emailAddress": "saleha_saheen@thbs.com",
 "phone": "9945678432",
 "company": "Thbs",
 "country": "Japan",
 "language": "Japanese",
 "jobTitle": "Software Engineer"
 },
 "additionalDetails": {
 "quantity": "1.0",
 "serialNumbers": "1234",
 "dateCodes": "20151212",
 "operatingSystem": "Windows8",
 "softwareVersion": "1.0"
 }
 }

--boundary_string

Content-Type: text/plain

Content-Disposition: form-data; name="Body"; filename="api-test.txt"

Binary data of the file goes here

--boundary_string--

Can you please advise me what logic I should write in OnBeforeRequest so that I can consume this API? It would be nice if show some demo.

Thanks and Regards,

Suraj Borade

Hi Suraj,

I'm not really understanding your question, could you give more information regarding your issue?

Either way here´s a link for the OutSystems official documentation regarding REST Connectors.

I hope I have been of some help and thank you for your feedback.

Cheers,

Rui


Solution

Hi Rui,

Thanks for the reply and yes you have been of some help. 

Actually I am trying to consume and use multipart web service. This web service needs to create a record at SAP side. Inputs required for this from Outsystems application are large JSON data and pdf file. So I was not sure how to consume this webservice.

But now I have resolved this issue. I am sending all request body in binary format by concatenating JSON data and file data. I will soon publish a component for how to consume multipart webservices in outsystems.

Cheers!!

Suraj Borade

Solution