目录

Deleting Hosted NFC Pass Data

Function

Deletes NFC pass data hosted on the Huawei server.

Scenario

This API is used to delete NFC pass data hosted on the Huawei server.

Restrictions

You do not need to call this API if you have implemented the APIs described in Implementing NFC Capability APIs on Your Server. Before using this API, contact Huawei technical support for development and joint commissioning.

Prototype

Protocol

HTTPS DELETE

Direction

Developer server -> Huawei server

URL

{url}/hmspass/v1/nfccard/personalizeddata/{serviceType}/{transId}

Set the {url} variable based on the region where the server is located. For details, please refer to Wallet Server Addresses.

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

URL Parameters

Parameter

Mandatory/Optional

Type

Description

serviceType

Mandatory

String(32)

Service name.

transId

Mandatory

String(32)

Transaction ID.

Request Parameters

Request Header

Parameter

Mandatory/Optional

Type

Description

Authorization

Mandatory

String

Authorization code. For details about how to obtain the value, please refer to the Client Credentials mode in OAuth 2.0-based Authentication. In this mode, client_id and client_secret are respectively the App ID and App key of the app that you created in AppGallery Connect. Concatenate the value of access_token to the end of Bearer, with a space in between, to generate the value of Authorization.

Content-Type

Mandatory

String

The value is always application/json;charset=utf-8.

Accept

Mandatory

String

The value is always application/json;charset=utf-8.

Request Example

DELETE /hmspass/v1/nfccard/personalizeddata/amber_house/amberHouse10001 HTTP/1.1
Content-Type: application/json;charset=utf-8
Authorization: Bearer ***
Accept: application/json;charset=utf-8
Host: wallet-passentrust-drcn.cloud.huawei.com.cn

Response Parameters

When the result code is 200:

Parameter

Type

Description

returnCode

String

Return code. The value 0 indicates success.

returnDesc

String

Return description. The value is success when the return code is 0.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json
{
  "returnCode": "0",
  "returnDesc": "success"
}

Result Codes

For details, please refer to Common Result Codes in the Common Definition section.

Call Example

public String deleteFromWalletServer(String urlSegment) {
    // Construct the HTTP header.    
    HttpHeaders header = constructHttpHeaders();    
    // Construct the HTTP URL.    
    String baseUrl = ConfigUtil.instants().getValue("walletServerBaseUrl");    
    String walletServerUrl = baseUrl + urlSegment;    
    HttpEntity<JSONObject> entity = new HttpEntity<>(null, header);    
    // Send the HTTP request and obtain the response.
    ResponseEntity<String> exchange =REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.DELETE, entity, String.class);    
    return exchange.getBody();
}