Skip to Content

Consume Rest Service API with SAP Cloud SDK for iOS Application (SAP iOS SDK)

I have REST service APIs of Python/Java. I want to configure the same in SAP Cloud SDK and create application for iOS platform.

I followed below link, but its configuration details are for old SAP cloud structure.

If any one can help me in configuring REST API service with new SAP cloud cockpit structure and also explain the steps to consume the same in iOS Application.

As per my analysis with REST API we don't have any metadata service, so iOS Assistance wont be able to create iOS Application for the same. So it would be helpful if any one can explain how to consume the cloud configured REST API in iOS Application for Authentication as well as fetching data.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 07, 2020 at 04:22 PM

    Hi Jyotishree,

    For writing an iOS app with SAP Cloud Platform Mobile Services with REST services (non-OData), you are correct that without a metadata file, the Assistant app will not be able to generate the project with the onboarding template (which includes the authentication that you want).

    You could learn about authentication with SAP Cloud Platform SDK for iOS in the SAPFoundation framework documentation. But, the easiest way to get this working is probably the following:

    1. Create the application definition directly in SAP Cloud Platform Mobile Services cockpit, rather than from the Assistant. Add a Destination for your REST service.
    2. Add the 'Sample Service' feature to the application (assuming you are in Cloud Foundry). This adds a 2nd destination, with an OData backend. Alternatively, you could add a 3rd party dummy service
    3. In the Assistant, generate the new Xcode project following the 'Reuse Existing App' flow. Use the 'Onboarding' template, rather than Master-Detail.
    4. Delete the folder named 'Proxy Classes' in the generated Xcode project.

    This will give you the app template with the onboarding & authentication pre-implemented. You can then reference your REST Service using the sapURLSession instance from the onboardingContext.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Stan,

      I followed your step and created an application. Please find below screen shot for reference.

      But as per your suggestion how to reference REST Service using the sapURLSession instance to the onboardingContext, as by default its taking authorisation information from ConfigurationProvider.plist and also use oData destination value(That we need to delete, as its a dummy URL) for authentication process.

      Also in cockpit destination, I have configured REST service base URL. In iOS application for respective URLs we need to add parameters to fetch data.

      Please help in below queries.

      1) How to reference REST Service using the sapURLSession instance to the onboardingContext, as its taking destination ID information for oData service, So If I remove proxy classes and OData Url, then how to authenticate the app as well as how to fetch data?

      2) How to fetch base URL of REST service through cloud?

      3) How to data respective URL's parameter to base service for cloud?



  • Posted on Jul 07, 2020 at 03:21 PM

    Hi Jyotishree,

    If you want to use the SAP Cloud SDK (for Java) to create a domain model for a REST service, then you need an OpenAPI specification file. If you do not have that file, then please ask the service maintainer to provide the file.

    If the maintainer is not providing you the specification file, then you have the following options:

    • Define your own specification file and generate a domain model with Cloud SDK. Then you need to maintain it yourself. Functional correctness must be managed by yourself.
    • Don't use an extensive domain model from Cloud SDK and instead try to access the data with hardcoded code by yourself. You may still use Cloud SDK for managing connectivity.

    Please note:

    Opposed to REST services, an OData service would require an EDMX / metadata file.

    Best regards


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.