Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

NowWeb API- iOS

The NowWeb API is a top-level global API that enables uses to instantiate a NowWeb service instance.

Parent Topic:Mobile SDK - iOS

NowWeb - makeWebService(instanceUrl: URL) async throws

Creates an instance of NowWebService using the previously specified configuration.

You must initialize the SDK prior to calling this function or the completion block is called with a sdkNotConfigured error. To initialize the SDK, call NowSDK.configure() with the desired configuration.

NameTypeDescription
instanceUrlURLURL of the ServiceNow instance whose web services are to be accessed by the service.
TypeDescription
NowWebServiceIf successful, returns an initialized NowWebService object.
NowServiceErrorThrows one of the following errors if the method fails.Possible values: - sdkNotConfigured - serviceConfigurationInvalid - serviceDisabled - serviceSettingsInvalid - serviceSettingsNotFound - serviceSettingsRetrievalFailed

The following code example shows how to call this method.

do {
    let service = try await NowWeb.makeWebService(instanceUrl: instanceUrl)
    self.webService = service
} catch {
    debugPrint("Web Service creation failed with error: \(error.localizedDescription)") 
}

NowWeb - makeWebService(instanceUrl: URL, completion: @escaping ((Result<NowWebService, NowServiceError>) -> Void))

Creates an instance of NowWebService using the previously specified configuration. When finished, calls the specified completion handler.

You must initialize the SDK prior to calling this function or the completion block is called with a sdkNotConfigured error. To initialize the SDK, call NowSDK.configure() with the desired configuration.

NameTypeDescription
instanceUrlURLURL of the ServiceNow instance whose web services are to be accessed by the service.
completion@escaping ((Result<NowWebService, Now​Service​Error>) -> Void)Completion handler that is called with a Result<NowWebService, NowServiceError> containing either an initialized NowWebService instance or a NowServiceError indicating why the initialization failed.
TypeDescription
None 
func initializeNowSDK(userEmail: String) {
  currentUser = userEmail
  let sdkConfig = NowSDKConfiguration(authorizationProvider: self, permissionDelegate: self, logLevel: .debug)

  do {
      try NowSDK.configure(with: sdkConfig)
      configureAnalytics()
  } catch {
      debugPrint("Could not initialize NowSDK. Error: \(error.localizedDescription)")
  }
}

NowWeb - makeWebService(instanceUrl: URL)

Creates an instance of NowWebService using the previously specified configuration.

Note: This method has been deprecated. You should use the async/await implementation of the method instead.

You must initialize the SDK prior to calling this function or the completion block is called with a sdkNotConfigured error. To initialize the SDK, call NowSDK.configure() with the desired configuration.

NameTypeDescription
instanceUrlURLURL of the ServiceNow instance whose web services are to be accessed by the service.
TypeDescription
AnyPublisher<NowWebService, NowServiceError>If successful, returns an initialized NowWebService object. If it fails, returns a NowServiceError object.
func initializeWebService() {
  NowWeb.makeWebService(instanceUrl: instanceUrl)
    .sink { completion in
      if case .failure(let error) = completion {
        debugPrint("Web Service creation failed with error: \(error.localizedDescription)")
      }
    } receiveValue: { [weak self] service in
        self?.webService = service
    }
    .store(in: &subscriptions)
  }