post request with php curl?

Discussion in 'Shapeways API' started by 397188_deleted, Jul 29, 2013.

  1. Does anyone have an example of how to create a post request with curl? The get example provided works well, but I can't understand how to properly construct the post body. Should all the oauth data (key,signature etc) be json encoded as well as the parameters and passed as the postfield?
     
  2. bartv
    bartv Member
    Hi,

    our API expert is on a short break this week - he'll return next week and he'll get back to you then.

    Cheers,

    Bart
     
  3. woody64
    woody64 Well-Known Member
    Same issue on my side since my provider doesn't offer Oauth.
     
  4. 1064125_deleted
    1064125_deleted Shapeways Employee Product Team
    Hi all,

    I think the concern is mainly around how to properly configure the OAuth header. In the PHP examples, the OAuth header is created by a pecl library, aptly named Oauth. You can see from the Authorize script that it is being created with new Oauth(...);

    https://github.com/Shapeways/shapew.../AuthorizeWithRequestUriQuery-oauth1-curl.php

    The above script goes through the steps to essentially do what the pecl library does to format the Header. I wouldn't recommend it as it's more trouble than it's worth.

    What would you like to test? I can point to more consumer friendly methods off the command line that can accomplish the same thing. Have you looked into Postman? It puts a friendly GUI for testing APIs. Let me know if you want to learn how to use it for your use case.

    Not sure what is meant by the provider doesn't offer Oauth.
     
  5. woody64
    woody64 Well-Known Member
    (Sorry maybe I used the wrong discussion thread since I searched for any other solution and was sure that in some thread it was also mentioned that the Oauth package is not provided by the provider)

    Php (5.6) is installed and managed by my Web Provider. The installation includes pecl but not the Oauth class.
    So I can't use the example scripts since Oauth is not defined then.

    Maybe that can be used instead of the pecl/Oauth but I don't have the time to check it.
    https://www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html