Requesting help with an external API request - "Actor input must have content type "application/json

Options
lijern
lijern Member
edited November 2023 in ? Working with APIs

Hi, I would really appreciate some help resolving my problem here. I am trying to make an external API request to an Apify actor with a POST request method to run actor synchronously and get dataset items. The debugger is saying "Actor input must have content type "application/json".", but I see "content-type: application/json" is already written in the header. How do I resolve this?

response

{headers: [HTTP/2 400,date: Fri, 03 Nov 2023 18:26:24 GMT,content-type: application/json; charset=utf-8,content-length: 123,cache-control: no-cache, no-store, must-revalidate,pragma: no-cache,expires: 0,access-control-allow-origin: *,access-control-allow-headers: User-Agent, Content-Type, Authorization, X-Apify-Request-Origin, openai-conversation-id, openai-ephemeral-user-id,access-control-allow-methods: GET, POST,access-control-expose-headers: X-Apify-Pagination-Total, X-Apify-Pagination-Offset, X-Apify-Pagination-Desc, X-Apify-Pagination-Count, X-Apify-Pagination-Limit,referrer-policy: no-referrer,x-robots-tag: none,x-ratelimit-limit: 200,etag: W/"7b-2QUGcaO1hCNQE8SGd2vv9gi+ii4",vary: Accept-Encoding],

result: {error: {type: invalid-input,message: Actor input must have content type "application/json".}},

status: 400

The input/result states after running: "Whoops! An error occurred.Exception: Please use a numerically indexed array."

Thanks!

Tagged:

Answers

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    Hi, @lijern. What you're showing here is the response (what the API is sending back), but we'll want to review the request to make sure the content type is specified. To specify the header, in the 'headers' section of your external API request, you can add a Push filter, and specify the value of "Content-Type: application/json". Let me know if this helps or if you have any other questions!