Gift Card Creation Weird Response

Hi,

I’m trying to utilise the gift_cards api to generate gift cards, we’ve already reached out to make sure that the gift cards API is enabled for our custom app’s API key, and I’ve enabled the correct scopes including these

I have no trouble making any of the GET requests found on the docs here but when it comes to making a POST request to generate a new gift card, I’m receiving this as a response

<html>

<body>
	<noscript>
		<a
			href="https://accounts.shopify.com/oauth/authorize?client_id=****&destination_uuid=****&nonce=****&prompt=merge&redirect_uri=https%3A%2F%2Fsarah-sebastian.myshopify.com%2Fadmin%2Fauth%2Fidentity%2Fcallback&response_type=code&scope=email%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly%20openid%20profile%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fbanking.manage%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fmerchant-setup-dashboard.graphql%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshopify-chat.admin.graphql%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fflow.workflows.manage%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Forganization-identity.manage&state=*****&ui_locales=en&ux=shop">Continue</a>
	</noscript>

	<script type="text/javascript" defer>
		window.location = "https:\/\/accounts.shopify.com\/oauth\/authorize?client_id=*****destination_uuid=7*****nonce=****prompt=merge\u0026redirect_uri=https%3A%2F%2Fsarah-sebastian.myshopify.com%2Fadmin%2Fauth%2Fidentity%2Fcallback\u0026response_type=code\u0026scope=email%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly%20openid%20profile%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fbanking.manage%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fmerchant-setup-dashboard.graphql%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshopify-chat.admin.graphql%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fflow.workflows.manage%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Forganization-identity.manage\u0026state=****ui_locales=en\u0026ux=shop";
	</script>
</body>

</html>

(note I’ve replaced any potential keys/sensitive info with **** to be cautious)
Is there something I’m missing? I’m using Postman to hit the API with my admin api key/secret correctly in the request url, and this is returning as 200.

Thanks in advance,

Ross

Hi Ross :waving_hand:

Thanks for the context! For custom apps from the Admin, we recommend using an access token in the header to make authenticated requests. The token can be revealed in the API credentials section of the scopes screenshot in your post, then added to the header with 'X-Shopify-Access-Token as the key. I’ve also seen this happen in Postman for POST requests, when the content type is not set to JSON.

Would you mind trying the below curl request to rule out any issues with Postman?

curl -L -X POST 'https://STORE-NAME.myshopify.com/admin/api/2022-10/gift_cards.json' \
-H 'X-Shopify-Access-Token: ACCESS-TOKEN' \
-H 'Content-Type: application/json' \
--data-raw '{ "gift_card": { "initial_value": 10 } }'

Hope that works!