[Jmap] Email/get after an Email/set with create

Mildred Ki'Lya <mildred-ml@mildred.fr> Tue, 09 November 2021 22:40 UTC

Return-Path: <mildred-ml@mildred.fr>
X-Original-To: jmap@ietfa.amsl.com
Delivered-To: jmap@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D13F93A121B for <jmap@ietfa.amsl.com>; Tue, 9 Nov 2021 14:40:06 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.088
X-Spam-Level:
X-Spam-Status: No, score=-2.088 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, T_SPF_PERMERROR=0.01, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=mildred.fr
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9PJ6shRe3xrU for <jmap@ietfa.amsl.com>; Tue, 9 Nov 2021 14:40:01 -0800 (PST)
Received: from ellomb.netlib.re (elyas.mildred.fr [193.33.56.74]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F33BD3A1230 for <jmap@ietf.org>; Tue, 9 Nov 2021 14:40:00 -0800 (PST)
Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by ellomb.netlib.re (Postfix) with ESMTPA id C7EC86AC6C14 for <jmap@ietf.org>; Tue, 9 Nov 2021 22:39:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mildred.fr; s=dkim; t=1636497594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fO97ibMyipQ0fwPfMVjXdV6elcyi/1sM13mXERvHbG8=; b=e2FQdRxs9KYccBsVWIGebbPbYNApJp1mcAiqL8JHlplw3VhzLj9WYc0NJ4d1sB2WqcOE/U +9KA7C5pU5CQo1WHjUL3Pi2FZUTJB2g7Pib/CrptoFFBSGQgAt8Z7MAM81eWncneky7i3t cjtTSPOF713svaFnrN/DPnJQqMwSFrE=
Message-ID: <0f29c977-e1f3-2275-7628-5f61e3eb4f33@mildred.fr>
Date: Tue, 09 Nov 2021 23:39:53 +0100
MIME-Version: 1.0
To: jmap@ietf.org
Content-Language: fr
From: Mildred Ki'Lya <mildred-ml@mildred.fr>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mildred.fr; s=dkim; t=1636497594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fO97ibMyipQ0fwPfMVjXdV6elcyi/1sM13mXERvHbG8=; b=P1lHfzpn92MKhp+2yj9thoPTjkgoTYwaiOSklzfLhuouTvEQXchqbYCyEk9DnnyK7dV+r7 xlWmSpK6wsOyWgFz15W3F/wfJ88HgcyvFqNNepsCtQkTwCH96Wgxe2DX+dW4NskWY6Ik0P VS3PvwtdlFImCgxZYXhu0Fx+ZPGeq2o=
ARC-Seal: i=1; s=dkim; d=mildred.fr; t=1636497594; a=rsa-sha256; cv=none; b=FGKXLMCU9c8Cw9UiimU2klXlXhwPOt1jufn9wyPxQyW/IKjEfK9rt1eniP3LEtiwJb5OWN +MzBW19GovIaoXRb6aQZo0xrGLSkFEIifcHODDVyOHoNu2Ma1n/ypbm5isdYfoFRLvqo87 l7R4SC3wjJt/QeeW15nhMDjt1UjiOLQ=
ARC-Authentication-Results: i=1; ellomb.netlib.re; auth=pass smtp.auth=mildred@mildred.fr smtp.mailfrom=mildred-ml@mildred.fr
Authentication-Results: ellomb.netlib.re; auth=pass smtp.auth=mildred@mildred.fr smtp.mailfrom=mildred-ml@mildred.fr
X-Spamd-Bar: /
Archived-At: <https://mailarchive.ietf.org/arch/msg/jmap/zL48jUAHDoZkuQPLBViPncg4r2Q>
Subject: [Jmap] Email/get after an Email/set with create
X-BeenThere: jmap@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: JSON Message Access Protocol <jmap.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jmap>, <mailto:jmap-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jmap/>
List-Post: <mailto:jmap@ietf.org>
List-Help: <mailto:jmap-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jmap>, <mailto:jmap-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Nov 2021 22:40:14 -0000

Hello,

It seems I ran in a corner case in JMAP. I'm trying to get an Email 
object right after its creation. The reason is that I can then access 
fields generated by the server such as the Message-ID or other headers.

My JMAP request looks like:

       ['Email/set', {
         accountId: jMail.accountId,
         destroy: [ email.id ],
         create: {
           draft: {
             mailboxIds: {
               [mailboxId]: true
             },
             messageId: email.messageId,
             subject: subject,
             bodyStructure: {
               type: "text/plain",
               partId: "body"
             },
             bodyValues: {
               body: {
                 value: body,
                 isTruncated: false
               }
             }
           }
         }
       }, '1'],
       ['Email/get', {
         accountId: jMail.accountId,
         "#ids": { resultOf: "1", name: "Email/set", path: "/created/*/id" }
       }, '2']

Here, the Email/get request fails because the path (/created/*/id) is 
invalid. Indeed, "/created" represents a JSON object indexed by a 
temporary id ("draft" in my example). I see no way to get the Email 
object without another round-trip.

Can someone enlighten me if I missed something?

Thank you