Clearing existing restFunctionService and API key question

조회 수: 5 (최근 30일)
Adan
Adan 2025년 2월 20일
답변: Hitesh 2025년 4월 9일
If I start a webservice rest API, how do I go about clearing it after it's finished/closed?
For example, let's create the service called "myService" that allows access to function addNumbers
service = restFunctionService("myService",["addNumbers"]);
I can run
service.close
or even
clear service
However, if I try to run
restFunctionService("myService",["addNumbers"]);
again MATLAB complains that "myService" already exists (in fact it's even still visible in the restFunctionServices dictionary). Only way to recreate the service is by restarting MATLAB.
Also, is there anyway to set the user API key manually or set it to null?

답변 (1개)

Hitesh
Hitesh 2025년 4월 9일
Hi @Adan,
I too encountered the similar issue, you need to use following command before clearing the service. Since the service was still running in the memory that's why you were getting the error of "service already exists".
delete service
For better understanding of workflow of creating and using the "restFunctionService", refer to the following command Window image"

카테고리

Help CenterFile Exchange에서 Image Data에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by