Group Abstract Group Abstract

Message Boards Message Boards

0
|
15.2K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

how to use URLfetch for use with http post

POSTED BY: Kay Herbert
5 Replies
POSTED BY: Hans Michel

I have version 10.1, cannot find BodyData but it works while Body does not.

POSTED BY: Kay Herbert

The Options section of the Documentation located http://reference.wolfram.com/language/ref/URLFetch.html has "Body" as the option for the payload. I am using Mathematica version 10.0.2 and the local documentation has "BodyData" as the option for the payload. I would go with your local documentation ref/URLFetch. I did not find it per se though, the payload concept is part of most HTTP Request/Response client and server implementations.

POSTED BY: Hans Michel

Thanks, that worked! Exactly what I was looking for. Where did you find the BodyData option?

POSTED BY: Kay Herbert

Kay Herbert:

Try

URLFetch[
    "https://apis.tdameritrade.com/apps/300/LogIn?source=#sourceID#&version=#version number#",
    "Method" -> "Post",
    "Headers" -> {"Content-Type" -> "application/x-www-form-urlencoded"},
    "BodyData" -> "userid=#userid#&password=#password#&source=#sourceID#&version=#version number#\n\n",
    "Cookies" -> True,
    "VerifyPeer" -> True]

These variables are assigned by TD Ameritrade, hopefully you have them

  • userid=#userid#
  • password=#password#
  • source=#sourceID#
  • version=#version number#

Also assume you can fill in the proper Mathematica variables and re-work this starter code to work. So the #variable# should be replaced with the correct strings.

Hans

POSTED BY: Hans Michel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard