Motoko Help on calling Type Structure

This is my Motoko function and structure (type) how i can call the canister from the console to use the function ?

type MarsLand = {
name: Text;
imageurl: Text;

// adds new MarsLand to 
public func addMarsLand (newMarsLand: MarsLand) : async Id {
    let id = next;
    next +%= 1;
    MarsLands := Trie.replace(

    return id;

My canister is marspoolxyx and can i call with below code in console.

dfx canister call marspoolxyz addMarsLand ‘{“tokenid:1001”,“name:Paris”,“imageurl:Rome”}’

Thanks for your reply

You’ll want to format it like this:

dfx canister call marspoolxyz addMarsLand '( record {name="Paris"; imageurl="Rome"; tokenid="1001"} )'

dfx uses the candid textual format, you can find a bit more info on this here:
And here:


Thank you Ori !
:heart:ing already !

Now, I am able to call from the candid from console.

But, how to do reference that in Javascript in front-end
This link is broken/404

The _assets directory in your project should get you started, and then this:

Thanks for spotting the broken link!

1 Like