Contentful logo

Contentful Community

Create entry fails: X-Contentful-Content-Type?

I’m trying to create an entry using the documentation at the link below. So far all I’ve been able to get is “404: The resource could not be found”. My query:
https://api.contentful.com/spaces/pmybmbmwva65/environments/master/entries

I am able to GET successfully so I think my Auth and other header vars are setup correctly.*

I believe the problem is with X-Contentful-Content-Type. In the documentation the example shows its value as some kind of hash (e.g., 2PqfXUJwE8qSYKuM0U6w8M). I cannot discover anything like this for my content type(s). The content type’s name is “area” and the UI says the “content type id” is “area”. I’ve tried using “area” to no avail.

Here’s the documentation I’m trying to follow:
https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries/entries-collection/create-an-entry/console

  • This is my first day trying to use this environment so I may be missing something obvious. To be certain, here are the header variables I’ve set:
    Content-Type: application/vnd.contentful.management.v1+json
    api_key: [my api key]
    X-Contentful-Organization: [my org’s id]
    X-Contentful-Content-Type: area

I have my Personal Access Token entered in Authentication and the prefix is “Bearer”.

Hi @harry,

The overall structure of your request looks just fine and it’d be good if you could double-check two things:

  1. What email account generated the token that you’ve used for this request? If that email account doesn’t have an appropriate role or access to the space, you shouldn’t be able to create the entry.

  2. Could you double-check the identifiers used in your request? (indeed for content type, as well as environment ID)

In the end, you can find the desired full structure in the following link:

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries/entry/create-update-an-entry/console/curl

Let me know if you have any other questions.

Thanks for the reply @gabriel… In the double-checking ALL the variable values got it working. The X-Contenful-Content-Type value was indeed “area” so I don’t know what the sample code is showing. In any event, after 3+ hours I’m correctly creating and updating so thanks again for the speedy response. Consider this item closed.

@harry Can you cast your mind back and remember what, in fact, got it working? I’m in the same boat. I’ve meticulously been through everything still to no avail ¯\_(ツ)_/¯