# Fetching multiple api with next.js getStaticProps hook

**URL:** <https://community.prismic.io/t/fetching-multiple-api-with-next-js-getstaticprops-hook/3423>\
**Category:** Developing with Prismic\
**Tags:** slice-machine\
**Created:** [January 5, 2021, 9:57am UTC](https://community.prismic.io/t/fetching-multiple-api-with-next-js-getstaticprops-hook/3423 "2021-01-05T09:57:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![juskeviciusarn](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/juskeviciusarn/32/1210_2.png) [@juskeviciusarn](https://community.prismic.io/u/juskeviciusarn)\
**Post date:** [January 5, 2021, 9:57am UTC](https://community.prismic.io/t/fetching-multiple-api-with-next-js-getstaticprops-hook/3423/1 "2021-01-05T09:57:38Z")

</div>

Hello, everyone

I'm struggling to think a way to fetch multiple api with useGetStaticProps method.

My use case I use slicemachine to render content which is set in prismic. Some content for slice is dynamic which sits in API.

So my question is how can I prefetch data from 2 apis(Prismic and My Custom Api) to get all data for slice.

I was looking into integration fields feature, but it seems a slicemachine doesn't support it.

One of ways I think that maybe splitting useGetStaticProps to smaller parts, that I could build it myself with extra return props.

Big thanks in advance. ❤🌸

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [January 7, 2021, 4:54pm UTC](https://community.prismic.io/t/fetching-multiple-api-with-next-js-getstaticprops-hook/3423/3 "2021-01-07T16:54:16Z")

</div>

HI Arnas,

Sorry about the delay, I needed to get some info from the team about how to do this.

So in this case, you shouldn't use `useGetStaticProps` method, instead query the client with Next.js `getStaticProps`. Then you can re-use the `next-slicezone/features/query`. You can see below how to do this:

> <https://github.com/prismicio/slice-machine/blob/master/packages/next-slicezone/hooks/useGetStaticProps.js#L26>

Let us know if you have any further questions.

---

<div class="post-metadata">

**Author:** ![juskeviciusarn](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/juskeviciusarn/32/1210_2.png) [@juskeviciusarn](https://community.prismic.io/u/juskeviciusarn)\
**Post date:** [January 8, 2021, 12:03pm UTC](https://community.prismic.io/t/fetching-multiple-api-with-next-js-getstaticprops-hook/3423/4 "2021-01-08T12:03:05Z")

</div>

Hello, Phil,

It works like a charm.

thank you for help ❤

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [January 9, 2021, 12:03pm UTC](https://community.prismic.io/t/fetching-multiple-api-with-next-js-getstaticprops-hook/3423/5 "2021-01-09T12:03:16Z")

</div>

closed on January 9, 2021, 12:03pm UTC as resolved,  flag & select 'Something Else' to reopen.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:56pm UTC](https://community.prismic.io/t/fetching-multiple-api-with-next-js-getstaticprops-hook/3423/6 "2021-12-09T17:56:44Z")

</div>

Opened on December 9, 2021, 5:56pm UTC


