Network: Difference between revisions

 
(9 intermediate revisions by the same user not shown)
Line 268: Line 268:
* "/start":
* "/start":
** The json POST data contains the following:
** The json POST data contains the following:
** <code>{"type":<type>,"scope":<scope>,"src_device_appearance_main":"<str0>","src_device_appearance_controller":"<str1>"}</code>
*** <code>{"type":<type>,"scope":<scope>,"src_device_appearance_main":"<str0>","src_device_appearance_controller":"<str1>"}</code>
** <type> is 0 for local (nn::migration::device::IServer and nn::migration::savedata::IServer), 1 for Uploader (nn::migration::device::IUploader).
*** <type> is 0 for local (nn::migration::device::IServer and nn::migration::savedata::IServer), 1 for Uploader (nn::migration::device::IUploader).
** <scope> is 0 for device (nn::migration::device::IServer and nn::migration::device::IUploader), 1 for savedata (nn::migration::savedata::IServer).
*** <scope> is 0 for device (nn::migration::device::IServer and nn::migration::device::IUploader), 1 for savedata (nn::migration::savedata::IServer).
** <str0> is the output from [[NS_services|ns]] IApplicationManagerInterface cmd4063, <str1> is from cmd4064.
*** <str0> is the output from [[NS_services|ns]] IApplicationManagerInterface cmd4063, <str1> is from cmd4064.
** The json response is parsed as the following (HTTP status must be 201):
*** <code>{"transfer_event":{"transfer_event_id":<number>,"status":<status_str>,"error":<str>,"src_device_serial":<str>,"src_device_appearance_main":<str>,"dst_device_serial":<str>,"src_device_type":<unknown>,"created_at":<timestamp>,"expires_at":<timestamp>}}</code>
*** The minimum required fields are status and expires_at. <status_str> must match one of various strings, such as "started".
*** The output transfer_event_id is then used as the first "%lld" in the above URIs.
*** The rest of the fields are likely only used with "nn::migration::device::*" (?).
 
* "/%lld/%s":
** The POST data is empty.
** The json response is parsed as the following (HTTP status must be 200):
*** This is parsed similar to /start above. The minimum required fields are the same as /start. The rest of the output is unused.
 
* "/%lld":
** This is used following certain network requests which failed, depending on the Result. In one case it's used without a prior network request.
** No POST data (?).
** The json response is parsed as the following (HTTP status must be 200):
*** This is parsed similar to /start above. The minimum required fields are the same as /start.
*** Most usage of this will return 0 instead of the Result from the request which failed, when status is the expected value and expires_at>0.
 
* "/%lld/register_destination":
** The json POST data contains the following:
*** <code>{"dst_device_appearance_main":"<str0>","dst_device_appearance_controller":"<str1>"}</code>
*** <str0>/<str1> are the same as with "/start".
** The json response is parsed as the following (HTTP status must be 200):
*** This is parsed similar to /start above. The minimum required fields are the same as /start. The rest of the output is unused.
 
* "/%lld/save_datas/%lld/generate_key_seed_package" / "/%lld/generate_key_seed_package":
** The json POST data contains the following:
*** <code>{"challenge":"%s"}</code>
*** Where %s is the 0x10-byte challenge ([[Filesystem_services#ISaveDataTransferManagerWithDivision|ISaveDataTransferManagerWithDivision GetChallenge]]) printed with "%02x" for each byte.
** The json response is parsed as the following:
*** <code>{"key_seed_package":<str>,"error":<...>,"code":<str>}</code>
*** When the HTTP status is 200, the key_seed_package string is base64 decoded. The output is then later used with [[Filesystem_services#ISaveDataTransferManagerWithDivision|ISaveDataTransferManagerWithDivision SetKeySeedPackage]].
*** Otherwise, the value of the "code" string is compared against a table, to determine the Result to return. ("error" is unused?)


== Others ==
== Others ==