cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Use Destinations During Local Development for Second API

huibin_lau
Participant
0 Likes
230

Hello all,

I am currently working on a UI module of a mta project. 

In my application I have two APIs, the default OData service and a REST API and I have maintained instance level destinations in BTP and calling the APIs when the app is running on BTP is totally fine.

I followed this blog and maintained a subaccount level destination as I am using managed app router.

However, when I call the APIs during local development, only the OData is working but the REST API is returning a Http 401 error.

This is my ui5.yaml

 

  customMiddleware:
    - name: fiori-tools-proxy
      afterMiddleware: compression
      configuration:
        ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
        ui5:
          path:
            - /resources
            - /test-resources
          url: https://ui5.sap.com
        backend:
          - path: /odata
            url: <odata hostname>.com
          - path: /workflow/rest
            url: <REST API hostname>.com          

 

My xs-app.json

 

  "routes": [
    {
      "source": "^/odata/v2/(.*)$",
      "target": "/odata/v2/$1",
      "destination": "odata_dest",
      "csrfProtection": false
    },  
    {
      "source": "^/workflow/(.*)$",
      "target": "/workflow/$1",
      "destination": "rest_api_dest",
      "csrfProtection": false
    }
  ]

 

The code to call the api

 

wfRequests = await Helper.callRest("/workflow/rest/v1/workflow-instances" + query, "GET");

 

huibin_lau_0-1741333912899.png

Appreciate if you could provide me some input.

Best Regards,

HB

Accepted Solutions (0)

Answers (0)