Discussions

Ask a Question
Back to All

RE: Keep getting a 201 Error

I posted this question a couple days ago but I'm reposting it hoping to get a response.

I'm trying to call the Animations API using this code

const url = 'https://api.d-id.com/animations'>;  
const options = {  
	method: 'POST',  
	headers: {  
		'Content-Type': 'application/json',  
		'Accept': 'application/json',  
		'Authorization': 'Basic ' + process.env.REACT_APP_D_ID_API_KEY,  
	},  
	body: JSON.stringify({  
		"source_url": "https://pngimg.com/uploads/face/face_PNG5654.png">,  
		"driver" : "bank://nostalgia"  
	})
};

The source_url is just a random test png from the internet.

Here's the error messages I see

Access to fetch at 'https://api.d-id.com/animations' from origin '{my url}' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Failed to load resource: net::ERR_FAILED

When I run a cURL request from PowerShell with the same information it works, but when I've tried this on localhost and my hosted website, they both return the same error.

Thanks