Skip to content

Revise HTTPS Outcalls skill documentation#60

Merged
raymondk merged 2 commits intomainfrom
fspreiss/update-https-outcalls
Mar 3, 2026
Merged

Revise HTTPS Outcalls skill documentation#60
raymondk merged 2 commits intomainfrom
fspreiss/update-https-outcalls

Conversation

@fspreiss
Copy link
Contributor

@fspreiss fspreiss commented Mar 3, 2026

Updates the HTTP Outcall skill documentation as follows:

  • Fix Motoko example to compile and run correctly. Replace hand-rolled type definitions with the compiler-provided import IC "ic:aaaaa-aa" types, add the missing is_replicated field, and use Blob directly instead of [Nat8] for the response body.

  • Fix consensus failures in POST examples. Add a dedicated transformPost function (both Motoko and Rust) that strips the response body in addition to headers, because httpbin.org's /post endpoint returns the caller's IP in the origin field, which differs across replicas. POST functions now return a status message instead of the non-deterministic body.

  • Use automatic cycle attachment. Replace hardcoded cycle amounts with Call.httpRequest from the ic mops package (Motoko) and document that ic_cdk::management_canister::http_request (Rust) does the same. Both use the ic0.cost_http_request system API under the hood.

  • Add pitfall for omitting max_response_bytes. New pitfall Improve repo structure, CI pipeline, and contributor experience #5 warns that omitting it defaults to 2MB and charges ~21.5B cycles on a 13-node subnet.

  • Correct the cycle cost formula. The original formula had request_bytes and response_bytes swapped. Updated with the correct per-byte rates (5,200/request byte, 10,400/max_response_bytes byte on a 13-node subnet), explained that the charge is against max_response_bytes (not actual response size), and documented the ic0.cost_http_request system API for runtime cost calculation.

  • Update prerequisites to require moc >= 0.14.10 and ic >= 2.1.0 in mops.toml.

@fspreiss fspreiss marked this pull request as ready for review March 3, 2026 08:19
@fspreiss fspreiss requested a review from derlerd-dfinity March 3, 2026 08:19
Copy link
Collaborator

@derlerd-dfinity derlerd-dfinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks a lot!

@raymondk raymondk merged commit a7d92ea into main Mar 3, 2026
6 checks passed
@raymondk raymondk deleted the fspreiss/update-https-outcalls branch March 3, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants