Jump to content


Photo

REST API, HEADERS empty

headers rest api

  • Please log in to reply
4 replies to this topic

#1 JDurrah

JDurrah

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 16 July 2013 - 01:30 PM

  Hello I need a help with RESTful API example
call to login return empty json

doing some debugging I found that HTTP headers not send so I get "Invalid API request type" exception. $_SERVER['HTTP_ZURMO_API_REQUEST_TYPE'], $_SERVER['HTTP_ZURMO_AUTH_USERNAME'] $_SERVER['HTTP_ZURMO_AUTH_PASSWORD'] are empty.

 

any idea?.



#2 raysto

raysto

    Zurmo Team

  • Administrators
  • 1,973 posts

Posted 16 July 2013 - 02:29 PM

We have Developer Sessions every Tuesday at 10:00AM Chicago Time (http://zurmo.org/for...arning-session/). You can always join today's session in 30 minutes and ask any questions to our technical team.


Ray Stoeckicht
Zurmo Team
Try Zurmo Pro


#3 JDurrah

JDurrah

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 17 July 2013 - 12:22 PM

No answer..

to those who use REST API. didn't you face this issue?



#4 mledwards

mledwards

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 17 July 2013 - 01:59 PM

Hi JDurrah,

Are you using the default functions provided here:

http://zurmo.org/wik...esthelper-class

http://zurmo.org/wik...-authentication

If so, can I check that you're setting the $headers like this:

$headers = array(
    'Accept: application/json',
    'ZURMO_AUTH_USERNAME: ' . SUPER_USERNAME_HERE,
    'ZURMO_AUTH_PASSWORD: ' . SUPER_PASSWORD_HERE,
    'ZURMO_API_REQUEST_TYPE: REST'
);

Then calling the API like this:

$response = ApiRestHelper::createApiCall("http://CRM_URL_HERE/app/index.php/zurmo/api/login', 'POST', $headers);

If so, what are you getting back from:

print_r($response);


#5 Liang

Liang

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 07 May 2015 - 05:35 AM

Are you using Nginx server? Probably you need to add: underscores_in_headers on;  to allow custom http headers.







Also tagged with one or more of these keywords: headers, rest api

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users