# Posting a concatenated data request to a Spaces API

**URL:** <https://discuss.huggingface.co/t/posting-a-concatenated-data-request-to-a-spaces-api/26722>\
**Category:** Spaces\
**Created:** [November 25, 2022, 11:52pm UTC](https://discuss.huggingface.co/t/posting-a-concatenated-data-request-to-a-spaces-api/26722 "2022-11-25T23:52:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![plexus3d](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@plexus3d](https://discuss.huggingface.co/u/plexus3d)\
**Post date:** [November 25, 2022, 11:52pm UTC](https://discuss.huggingface.co/t/posting-a-concatenated-data-request-to-a-spaces-api/26722/1 "2022-11-25T23:52:59Z")

</div>

I’m testing gradio API access for a HuggingFace Space; for an API that requires we post one image via its URL, I have successfully used:

> data = gr.processing\_utils.encode\_url\_or\_file\_to\_base64(image\_url)  
> r = requests.post(url=‘[https://hf.space/embed/tmabraham/fastai\_pet\_classifier/+/api/predict/](https://hf.space/embed/tmabraham/fastai_pet_classifier/+/api/predict/)’, json={“data”:[data]})

Can anyone provide an example of posting a concatenated data request to HF in a similar way? The API below expects (2) images (as str, as above) and an additional string. What is the best practice?

> Input Payload  
> {  
> “data”: [  
> str | Dict, // represents base64 url data, or (if tool == “sketch”) a dict of image and mask base64 url data of ‘Image1’ image component  
> str | Dict, // represents base64 url data, or (if tool == “sketch”) a dict of image and mask base64 url data of ‘Image2’ image component  
> str, // represents selected choice of ‘Task’ radio component  
> ]  
> }  
> Response Object  
> {  
> “data”: [  
> str, // represents base64 url data of ‘flow/disparity’ image component  
> ],  
> “duration”: (float) // number of seconds to run function call  
> }

---

<div class="post-metadata">

**Author:** ![plexus3d](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@plexus3d](https://discuss.huggingface.co/u/plexus3d)\
**Post date:** [November 27, 2022, 6:08pm UTC](https://discuss.huggingface.co/t/posting-a-concatenated-data-request-to-a-spaces-api/26722/2 "2022-11-27T18:08:42Z")

</div>

My JSON syntax for concatenation was fine, the server errors I saw were from a separate problem discussed in [this Spaces post](https://discuss.huggingface.co/t/spaces-post-response-413-request-entity-too-large/26723).
