#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    138
    Rep Power
    19

    cfhttp content-type header


    I need to make a get request to an API(a stupid narrow sighted limiting API). The request must be a GET request and have the content-type in the header specify application/json.

    It might be because it's late but whenever i request a page:
    Code:
    <cfhttp url="myurl"
            useragent="Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.7 (KHTML, like Gecko) Chrome/5.0.391.0 Safari/533.7"
            result="result"
    >
    
        <cfhttpparam type="header" name="Content-Type" value="application/json">
    
    </cfhttp>
    When i put this request in it ignores my cfhttpparam and the content-type is xml.

    I read that you need to POST to specify this but that can't be right, can it?!?!? This stupid API won't allow post requests. Is there anyway i can achieve this?

    Thanks,
    DSFX
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    970
    Content-Type only applies to PUT and POST requests, since they're the only ones that actually send content. If they're requiring Content-Type for GET requests then their REST API is completely invalid.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    138
    Rep Power
    19
    Thanks Kiteless,

    After going through the docs for this monstrosity i had my suspicions. If you'll excuse me i need to go write a sharply worded email.

    DSFX

IMN logo majestic logo threadwatch logo seochat tools logo