Dataclay — Automating Digital Production
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Register
    • Login

    Mapping data from Json returning URL.

    Scheduled Pinned Locked Moved
    Remote URL Feeds
    2
    2
    594
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • omsundefined
      oms
      last edited by oms

      I am trying to map data from JSON returning URL using Dataclay templator.

      “https://reqres.in/api/products/2”
      I got this URL online for testing and returning the below given data.

      {"data":{"id":2,"name":"fuchsia rose","year":2001,"color":"#C74375","pantone_value":"17-2031"},"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}
      

      I am not able to map it with layers and receiving this error.

      Error: Unable to retrieve or interpret remote JSON data.  Ensure the URL entered is correct and that you are authorized.
      

      Same out of URL I tried with JSON file then I am able to map. But not with URL.
      can someone guide me? what needs to be done? or I am missing something.

      I tried to find tutorials as well how to map data from JSON returning URLs step by step nothing comes up apart from mapping from google sheet.

      1 Reply Last reply Reply Quote 0
      • ariestavundefined
        ariestav
        last edited by

        @oms The structure of the data returned is not readable by Templater. You need to have it respond to your request as an array of objects. Inside the objects, you cannot have nested objects either. You actually can, but Templater will ignore it.

        So for example your structure now is this:

        {
          "data": {
                        "id":2,
                        "name":"fuchsia rose",
                        "year":2001,
                        "color":"#C74375",
                        "pantone_value":"17-2031"
                  },
          "support": {
                        "url":"https://reqres.in/#support-heading",
                        "text":"To keep ReqRes free, contributions towards server costs are appreciated!"
                            }
        }
        

        But really it needs to be an array, and it needs to be “flat” objects inside that array. So it would be best to do:

        [
            {
               "id" : 2,
               "name" : "fuchsia rose",
               "year" : 2001,
               "color" : "#C74375",
               "pantone_value" : "17-2031",
               "url" : "https://reqres.in/#support-heading",
               "text" : "To keep ReqRes free, contributions towards server costs are appreciated!"
            }
        ]
        

        Note how the singular object is still within an array [ ]. Also note that there are no nested objects in that singular object in the array.

        Does this help?

        1 Reply Last reply Reply Quote 0
        • First post
          Last post