Layout images wont load when using the create api | Community
Skip to main content
Answered

Layout images wont load when using the create api


Hi @Liz @mathio it’s me again, sorry for being such a bother, I was finally able to get the form updated with the new sections in the order I want but now I found this, when using attachments without layout, the image loads just fine
 

[
    'attachment' => [ 
        'href' => "https://images.typeform.com/images/4BKUhw8A9cSM",
        'type' => 'image'
    ],
    'properties' => [
        'description' => 'details',
        'hide_marks' => true
    ],
    'ref' => 'event',
    'title' => 'name',
    'type' => 'statement'
]

But then just after this little change to use the layout, the image won’t show up, even though it sets the split

 

[
    'layout' => [
        'attachment' => [ 
            'href' => "https://images.typeform.com/images/4BKUhw8A9cSM",
            'type' => 'image'
        ],
        'placement' => 'left',
        'type' => 'split'
    ],
    'properties' => [
        'description' => 'details',
        'hide_marks' => true
    ],
    'ref' => 'event',
    'title' => 'name',
    'type' => 'statement'
]


I get something like this
 

 

I’m counting on you again guys, thanks in advance!

Best answer by mathio-tf

Hi @neovldz sorry for a late answer.

I just tried a PUT to https://api.typeform.com/forms/i2pIXcsx with a payload like this and it worked:

{

  "title": "title",
  "type": "form",
  "fields": [
    {
      "layout": {
        "attachment": { 
          "href": "https://images.typeform.com/images/4BKUhw8A9cSM",
          "type": "image"
        },
        "placement": "left",
        "type": "split"
      },
      "properties": {
        "description": "details",
        "hide_marks": true
      },
      "ref": "event",
      "title": "name",
      "type": "statement"
    }
  ],
  "workspace": {
    "href": "https://api.typeform.com/workspaces/7rcxDr"
  }
}

The resulting typeform is here: https://form.typeform.com/to/i2pIXcsx and it currently looks like this after the update above:

 

In your case it looks like the image on the left did not load? The issue might be with displaying the form rather than the API. Can you inspect the element to see if the image is there or if it had  issues with loading in network tab?

Or maybe just provide you typeform URL and I can have a look for you.

View original

6 replies

Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14905 replies
  • May 8, 2023

Hi @neovldz Thanks for stopping by and sharing all this! @mathio will definitely be your best help for this!


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • Answer
  • May 15, 2023

Hi @neovldz sorry for a late answer.

I just tried a PUT to https://api.typeform.com/forms/i2pIXcsx with a payload like this and it worked:

{

  "title": "title",
  "type": "form",
  "fields": [
    {
      "layout": {
        "attachment": { 
          "href": "https://images.typeform.com/images/4BKUhw8A9cSM",
          "type": "image"
        },
        "placement": "left",
        "type": "split"
      },
      "properties": {
        "description": "details",
        "hide_marks": true
      },
      "ref": "event",
      "title": "name",
      "type": "statement"
    }
  ],
  "workspace": {
    "href": "https://api.typeform.com/workspaces/7rcxDr"
  }
}

The resulting typeform is here: https://form.typeform.com/to/i2pIXcsx and it currently looks like this after the update above:

 

In your case it looks like the image on the left did not load? The issue might be with displaying the form rather than the API. Can you inspect the element to see if the image is there or if it had  issues with loading in network tab?

Or maybe just provide you typeform URL and I can have a look for you.


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14905 replies
  • May 16, 2023

Hi @neovldz Are you still having troubles with the images using the API? Let us know if we can help!


  • Author
  • Explorer
  • 4 replies
  • May 22, 2023

Hey, sorry for the delay, I did notice this issue is there for all the forms I create using the api, the thing is, it only affects the “Create Screen” if I use the link it gives me on share then I am able to see the images, I have no problem with this since I know the images will be there but it will be good if you could give it a quick check to be sure.

I tried to inspect the element and this is what I am seeing, the first screenshot is from the create screen and the other is from the online typeform, looks like for some reason the Picture tag is missing from the first.
 


 


Don’t worry too much about it right now since as I said its not really important to me since I end up seeing the images in the final product, just keep an eye on it in case it happens to someone else.

P.S.
Don’t want to create a new post just to ask this so I’m hoping you can help me out here, will need a new post if I need to but… Is it possible to retrieve all responses all together in the https://api.typeform.com/forms/{form_id}/responses endpoint? Asking because when I’m not sending the ‘completed’ parameter, I only get the ones that were submitted it seems, but when I send it with a ‘false’ value then I get only what seems to be the “views” since it has ‘landed_at’ but not ‘submitted_at’

Thank you very much!


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14905 replies
  • May 22, 2023

Hi @neovldz thanks for sending this over! @mathio might be able to help you with this. 

As for the responses, are you looking for partial responses? If so, I’m afraid we don’t collect any information that isn’t directly submitted on the form. You can read more about this here


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • May 23, 2023

if I use the link it gives me on share then I am able to see the images

What other link are you using to access the form? Which URL does not display the images correctly? I am curious now 😃

I think if you send parameter completed=false it will only display form “views” with some meta data. Partial responses to your typeform questions are not collected.


Reply