That won't work with the existing endpoint. The webapi validates the request based on the phpdocs defined for the method in the service class. for Magento\Checkout\Api\ShippingInformationManagementInterface::saveAddressInformation
the request/response requirements are:
/**
* @param int $cartId
* @param \Magento\Checkout\Api\Data\ShippingInformationInterface $addressInformation
* @return \Magento\Checkout\Api\Data\PaymentDetailsInterface
*/
If you don't want to populate the address object you could create your own service to meet your requirements. For the shipping address it would look something similar to the following. Although you may also need to implement a separate service for setting the shipping method information. The shipping method information is included with the address information in the current service and used for recalculating totals and return available payment methods in the billing/payment step.
Vendor/Module/etc/webapi.xml
<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/carts/:cartId/shipping-information-by-id" method="POST">
<service class="Vendor\Module\Api\ShippingInformationByIdManagementInterface" method="saveAddressInformation"/>
<resources>
<resource ref="Magento_Cart::manage" />
</resources>
</route>
</routes>
Vendor/Module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Vendor\Module\Api\ShippingInformationByIdManagementInterface" type="Vendor\Module\Model\ShippingInformationByIdManagement" />
</config>
Vendor/Module/Api/ShippingInformationByIdManagementInterface.php
<?php
namespace Vendor\Module\Api;
/**
* Interface for managing customer shipping address information by id
* @api
*/
interface ShippingInformationByIdManagementInterface
{
/**
* @param int $cartId
* @param int $addressId
* @return \Magento\Checkout\Api\Data\PaymentDetailsInterface
*/
public function saveAddressInformation(
$cartId,
$addressId
);
}
Vendor/Module/Model/ShippingInformationByIdManagement.php
<?php
namespace Vendor\Module\Model;
class ShippingInformationByIdManagementManagement implements \Vendor\Module\Api\ShippingInformationByIdManagementInterface
{
/**
* {@inheritDoc}
*/
public function saveAddressInformation(
$cartId,
$addressId
) {
/**
* Your custom logic for saving the address by id
*/
}
}