[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: HTTPAPI How to do a POST



The sending and receiving is straight forward. Look at any of the post examples. JSON is just data that you can post.

But more importantly for your purposes, it says you are going to use OAuth. That will have to be hand coded as I don't think anyone has shared their code to do that. Adding the headers is not hard. But you have to get the client identifier and secret, store it someplace (maybe in your program?), and do the handshake to get the oauthToken to put into the header yourself. I believe several people on the list have successfully navigated the OAuth so you might be able to get some help if you ask but as I said, no one shared code that I could remember or find.

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Henrik Rützou
Sent: Monday, August 26, 2013 5:34 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: HTTPAPI How to do a POST

Hi Kevin,

the HTTP header is a HTTPAPI thing, but you can mix powerEXT Core procedures
(that supports json I/O) and HTTPAPI

Outgoing:

setContent('*none');
jsonNode('*object');
  jsonNode('*string':'email':'somebody@xxxxxxxxxxxxx');
  jsonNode('*string':givenName':'Fred');
  jsonNode(*string':surname':Rubble');
jsonEndNode();

The Json object will be in bufAddr() and bufSize()


Ingoing (simple json string):

myMail = jsonToField(inAddr:inSize:'email');
myName = jsonToField(inAddr:inSize:'givenName');
mySurname = jsonToField(inAddr:inSize:'surname');


If there is any special data encodings the jsonNode() and jsonToField() will
handle them.



On Mon, Aug 26, 2013 at 11:00 PM, Kevin Miller <kmiller@xxxxxxxxx> wrote:

>    With the following settings:
>
>
>    HTTP/1.1
>    Accept: application/json
>    Content-Type: application/json
>    Authorization: OAuth oauth_token={oauthToken}
>
>    {
>      "email": "somebody@xxxxxxxxxxxxx",
>      "givenName": "Fred",
>      "surname": "Rubble"
>    }
>
>    I need to set it up to use json data both to and from the external API,
>    and pass in an email address, first and last name. I don't think I need
>    a parser, as the data is very limited that I'm passing in and getting
>    back. I also need to pass in an API Key as shown above in the
>    Authorization line.
>
>
>    Kevin
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
>
>


-- 
Regards,
Henrik Rützou

 http://powerEXT.com <http://powerext.com/>
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------