Skip to content

Service

This is a .service file that defines an OData Service destination. The DestinationName property is used as the suffix to the SapCloudPlatformEndpoint URL when queries are made using this service.

A service can run in an online or offline mode.

To configure a service for online mode, set the OfflineEnabled parameter in the .service file to false. In this case, the MDK client communicates directly with the OData service. You can configure your apps to perform reads and updates to synchronize the client data.

To configure a service for offline mode, set the OfflineEnabled parameter in the .service file to true. In this case, the MDK client communicates with the OData service via the offline OData provider. You can configure your apps to initialize a data store and synchronize it with the OData service.

Service Properties

Property Type Required
DestinationName string Required
Headers object Optional
LanguageURLParam string Optional
OfflineEnabled boolean Optional
OfflineOptions object Optional
OnlineOptions object Optional
PathSuffix string Optional
ServiceUrl string Required

DestinationName

The destination name of the OData service in the Mobile Services

  • type: string

Headers

The headers set in a service will be included in all OData requests for the service. If additional custom headers is defined in an OData action or an OData function in ClientAPI, the service headers will be merged into the custom headers in the OData action or OData function in ClientAPI.

  • type: object

LanguageURLParam

Indicates if this service can accept requests with language parameter

  • type: string

OfflineEnabled

Indicates if this service runs in offline mode

  • type: boolean

OfflineOptions

Additional options for the service if OfflineEnabled is set to true

  • type: object with following properties.
Property Type Required Default
ServiceOptions OfflineServiceOptions Optional
CSDLOptions CSDLOptions Optional
StoreParameters StoreParameters Optional

ServiceOptions

Offline options for interaction with a data service.

CSDLOptions

Options for CSDL Parser

StoreParameters

Offline store OData parameters


OnlineOptions

Additional options for the service if OfflineEnabled is set to false

  • type: object with following properties.
Property Type Required Default
ServiceOptions OnlineServiceOptions Optional
CSDLOptions CSDLOptions Optional

ServiceOptions

Online options for interaction with a data service.

CSDLOptions

Options for CSDL Parser


PathSuffix

The path suffix that will be appended to the DestinationName and used to initialize the Online Service or Offline store. If OfflineEnabled is set to true, then you must also set OfflineOptions > StoreParameters > StoreName

  • type: string

ServiceUrl

URL to the OData service (deprecated). Service URL will now be taken from the SAPCloudPlatformEndpoint in brandedSettings.json or overrides.json or Onboarding URL.

  • type: string

Examples

{
  "DestinationName": "com.sap.sam.swa",
  "OfflineEnabled" : true,
  "LanguageURLParam": "sap-language",
  "Headers": {
    "Accept-Language": "/MyMDKApp/Rules/GetLanguage.js"
  }
}

Offline Service With CSDL Options and Store Parameters

{
  "DestinationName":"Northwind",
  "PathSuffix":"/V3/OData/OData.svc",
  "OfflineEnabled" : true,
  "LanguageURLParam": "sap-language",
  "OfflineOptions": {
    "ServiceOptions": {
      "supportsBind": false,
      "supportsPatch": false,
    },
    "CSDLOptions": [
      "allowCaseConflicts",
      "defaultVariableScale",
      "defaultVariableSrid",
      "disableFacetWarnings",
      "disableLoggingOfErrors",
      "disableLoggingOfWarnings",
      "disableNameValidation",
      "excludeServerOnlyElements",
      "failIfProviderIncompatible",
      "ignoreAllAnnotations",
      "ignoreAllReferences",
      "ignoreEdmAnnotations",
      "ignoreExternalReferences",
      "ignoreInternalReferences",
      "ignoreStandardReferences",
      "ignoreUndefinedTerms",
      "ignoreXmlAnnotations",
      "logWithUnqualifiedFileNames",
      "processMixedVersions",
      "resolveUndefinedTerms",
      "retainOriginalText",
      "retainResolvedText",
      "traceParsingOfElements",
      "strictFacetWarnings",
      "warnAboutUndefinedTerms",
      "warnIfProviderIncompatible"
    ],
    "StoreParameters": {
      "EnableIndividualErrorArchiveDeletion": true
    }
  }
}

Online Service with Service Options & CSDL Options

{
  "DestinationName":"Northwind",
  "PathSuffix":"/V3/OData/OData.svc",
  "OfflineEnabled" : false,
  "LanguageURLParam": "sap-language",
  "OnlineOptions": {
    "ServiceOptions": {
      "avoidInPaths": "test",
      "cacheMetadata": false,
      "checkQueries": false,
      "checkResults": false,
      "checkVersion": false,
      "dataFormat": 1,
      "dataVersion": 0,
      "databaseOnly": false,
      "fixMissingEmptyLists": false,
      "fixMissingNullValues": false,
      "logErrors": false,
      "logWarnings": false,
      "metadataFile": "test",
      "metadataText": "test",
      "metadataURL": "/Test/$metadata",
      "pingAccept": "application/json",
      "pingMethod": "GET",
      "pingResource": "/",
      "requiresToken": "X-CSRF-Token",
      "requiresType": false,
      "supportsAlias": false,
      "supportsBatch": false,
      "supportsBind": false,
      "supportsDelta": false,
      "supportsNext": false,
      "supportsPatch": false,
      "supportsUnbind": false,
      "statefulService": false
    },
    "CSDLOptions": [
      "allowCaseConflicts",
      "defaultVariableScale",
      "defaultVariableSrid",
      "disableFacetWarnings",
      "disableLoggingOfErrors",
      "disableLoggingOfWarnings",
      "disableNameValidation",
      "excludeServerOnlyElements",
      "failIfProviderIncompatible",
      "ignoreAllAnnotations",
      "ignoreAllReferences",
      "ignoreEdmAnnotations",
      "ignoreExternalReferences",
      "ignoreInternalReferences",
      "ignoreStandardReferences",
      "ignoreUndefinedTerms",
      "ignoreXmlAnnotations",
      "logWithUnqualifiedFileNames",
      "processMixedVersions",
      "resolveUndefinedTerms",
      "retainOriginalText",
      "retainResolvedText",
      "traceParsingOfElements",
      "strictFacetWarnings",
      "warnAboutUndefinedTerms",
      "warnIfProviderIncompatible"
    ]
  }
}

Service Url (Deprecated)

If DestinationName is not specified, the destination name will be taken from the ServiceURL property. This is done by taking the last path component from the URL.

{
  "ServiceUrl":"https://mobile-w00070145a18.int.sap.hana.ondemand.com/com.sap.sam.swa",
  "OfflineEnabled" : true,
  "LanguageURLParam": "sap-language"
}