Nota
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba mendaftar masuk atau menukar direktori.
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
Mencipta sesi berdasarkan templat sesi dan mengembalikan pengecam unik sesi.
Sintaks
Microsoft.Apm.createSession(SessionInput);
Parameter
| Nama | Jenis | Diperlukan | Penerangan |
|---|---|---|---|
| Input Sesi | Rentetan | Ya | Sifat input JSON bagi sesi yang akan dibuat. |
Struktur parameter JSON SessionInput adalah seperti berikut:
{
/**
* Returns the name of the template used in the session
*/
templateName: string;
/**
* additional information for session creation
*/
sessionContext: Map<string, string>;
/**
* will focus after session is created
*/
isFocused?: boolean;
/**
* Indicates whether the session should be restored after creation.
* If set to true, the session is restored in the agent workspace. Else, the session is created without being restored.
*/
shouldRestore?: boolean;
}
Nilai pulangan
Pengecam sesi sebagai Rentetan.
Contoh
Contoh-contoh ini menggunakan createSession kaedah untuk mencipta sesi baharu yang melepasi pengecam rekod entiti dan templat sesi sebagai parameter.
Buat sesi asas
Mencipta sesi baharu yang menghantar insiden sebagai nama entiti, ID insiden sebagai entityId dan nama unik templat sesi sebagai templateName.
Nota
Pengguna yang menggunakan kaedah ini mesti diperuntukkan kepada profil aplikasi yang mengandungi templat sesi.
x=new Map();
x.set("parametersStr", '[["entityName", "incident"], ["entityId", "11bb11bb-cc22-dd33-ee44-55ff55ff55ff"]]');
Microsoft.Apm.createSession({templateName: "case_entity_session_default_template", sessionContext: x});
Cipta sesi yang tidak fokus
x=new Map();
x.set("parametersStr", '[["entityName", "incident"], ["entityId", "22cc22cc-dd33-ee44-ff55-66aa66aa66aa"]]');
Microsoft.Apm.createSession({templateName: "case_entity_session_default_template", sessionContext: x, isFocused: false});