1# ArkWeb_CookieManagerAPI 2 3## Overview 4 5Defines the native cookie manager APIs provided by ArkWeb. Before calling the API, you are advised to use **ARKWEB_MEMBER_MISSING** to check whether the function struct has the corresponding pointer to avoid crash caused by mismatch between the SDK and the device ROM. 6 7**Since**: 12 8 9**Related module**: [Web](capi-web.md) 10 11**Header file**: [arkweb_type.h](capi-arkweb-type-h.md) 12 13## Summary 14 15### Member Variables 16 17| Name| Description| 18| -- | -- | 19| size_t size | Size of the struct.| 20 21 22### Member Functions 23 24| Name | Description | 25|-------------------------------------------------------------------------------------------------------------------------------------------|--------------------| 26| [ArkWeb_ErrorCode (\*fetchCookieSync)(const char* url, bool incognito, bool includeHttpOnly, char** cookieValue)](#fetchcookiesync) | Obtains the cookie value of a specified URL.| 27| [ArkWeb_ErrorCode (\*configCookieSync)(const char* url,const char* cookieValue, bool incognito, bool includeHttpOnly)](#configcookiesync) | Sets the cookie value of a specified URL. | 28| [bool (\*existCookies)(bool incognito)](#existcookies) | Checks whether cookies exist. | 29| [void (\*clearAllCookiesSync)(bool incognito)](#clearallcookiessync) | Clears all cookies. | 30| [void (*clearSessionCookiesSync)()](#clearsessioncookiessync) | Clears all session cookies. | 31 32## Member Function Description 33 34### fetchCookieSync() 35 36``` 37ArkWeb_ErrorCode (*fetchCookieSync)(const char* url, bool incognito, bool includeHttpOnly, char** cookieValue) 38``` 39 40**Description** 41 42Obtains the cookie value of a specified URL. 43 44**Parameters** 45 46| Name| Description| 47| -- | -- | 48| const char* url | URL of the cookie to obtain. A complete URL is recommended.| 49| bool incognito | Whether to obtain the webview memory cookie in incognito mode or in non-incognito mode. The value **true** means to obtain the webview memory cookie in incognito mode, and the value **false** means the opposite.| 50| bool includeHttpOnly | Whether to include the cookie marked as **HttpOnly** in **cookieValue**.| 51| char** cookieValue | Cookie value of the URL.| 52 53**Returns** 54 55| Type | Description | 56|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| 57| [ArkWeb_ErrorCode](capi-arkweb-error-code-h.md#arkweb_errorcode) | Error code.<br>[ARKWEB_SUCCESS](capi-arkweb-error-code-h.md#arkweb_errorcode): The cookie is successfully obtained.<br>[ARKWEB_INVALID_URL](capi-arkweb-error-code-h.md#arkweb_errorcode): The URL is invalid.<br>[ARKWEB_INVALID_PARAM](capi-arkweb-error-code-h.md#arkweb_errorcode): The parameter is invalid.| 58 59### configCookieSync() 60 61``` 62ArkWeb_ErrorCode (*configCookieSync)(const char* url,const char* cookieValue, bool incognito, bool includeHttpOnly) 63``` 64 65**Description** 66 67Sets the cookie value of a specified URL. 68 69**Parameters** 70 71| Name| Description| 72| -- | -- | 73| const char* url | URL of the specified cookie. It must be a complete URL.| 74| const char* cookieValue | Cookie value to be set.| 75| bool incognito | Whether to set the cookie of corresponding URL in incognito mode. The value **true** means to set the cookie of corresponding URL in incognito mode, and **false** means the opposite.| 76| bool includeHttpOnly | Whether to overwrite the cookie marked as **HTTPOnly**. The value **true** means to overwrite the cookie marked as **HTTPOnly**, and **false** means the opposite.| 77 78**Returns** 79 80| Type | Description | 81|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| 82| [ArkWeb_ErrorCode](capi-arkweb-error-code-h.md#arkweb_errorcode) | Error code.<br>[ARKWEB_SUCCESS](capi-arkweb-error-code-h.md#arkweb_errorcode): The cookie is successfully obtained.<br>[ARKWEB_INVALID_URL](capi-arkweb-error-code-h.md#arkweb_errorcode): The URL is invalid.<br>[ARKWEB_INVALID_PARAM](capi-arkweb-error-code-h.md#arkweb_errorcode): The parameter is invalid.| 83 84### existCookies() 85 86``` 87bool (*existCookies)(bool incognito) 88``` 89 90**Description** 91 92Checks whether cookies exist. 93 94**Returns** 95 96| Type| Description| 97|----|----| 98| bool | **true** is returned if the cookie exists; otherwise, **false** is returned. | 99 100### clearAllCookiesSync() 101 102``` 103void (*clearAllCookiesSync)(bool incognito) 104``` 105 106**Description** 107 108Clears all cookies. 109 110**Returns** 111 112| Type| Description| 113|----|----| 114| bool incognito | Whether to clear all cookies in incognito mode. The value **true** means to clear all cookies in incognito mode, and **false** means the opposite. | 115 116 117### clearSessionCookiesSync() 118 119``` 120void (*clearSessionCookiesSync)() 121``` 122 123**Description** 124 125Clears all session cookies. 126