Lulu Developer Forums

API Applications

RSS Feed

Problem in API using PHP cURL

    • Raja
    • Topic created 3 years ago

    Hi Ryan,

    Whenever i hit the lulu URL via PHP cURL i'm getting error, here is few for your reference

    1. Array
    (
    [error_value] => Books must have a positive page count set for pricing.
    [error_type] => LApiInvalidArgumentsException
    )
    this error raised when i hit the URL : https://apps.lulu.com/api/publish/v1/base_cost

    i have given the inputs like this

    $url = 'https://apps.lulu.com/api/publish/v1/base_cost';
    $ch1 = curl_init();
    curl_setopt($ch1, CURLOPT_URL, $url);

    $data = "api_key=" . urlencode($api_key) .
    "&auth_user=" . urlencode($auth_user) .
    "&auth_token=" . urlencode($auth_token) .
    "&project=" . urlencode(json_encode($project_json)) .
    "&pageCount=pageCount";

    curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch1, CURLOPT_POST, true);
    curl_setopt($ch1, CURLOPT_VERBOSE, true);
    curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch1, CURLOPT_POSTFIELDS, $data);

    I feel better if you provide me the API in PHP via cURL that would be fast and easy to use LULU API.

    Thanks,
    Raja

    Message edited by Raja 3 years ago

  1. Josiah Gore3 years ago

    I looked into this and it points out an error in our documentation: pageCount should actually be page_count. Try changing the last part of your $data string to

    "&page_count=" . $pageCount;

    And see if that works for you.

    I've updated the documentation accordingly.

  2. Raja3 years ago

    Yes, it worked for me. Thanks for your response

    Regards,
    Raja

[ Page 1 of 1 ]