Bad Request. No token or API key provided


#1

I am trying to call other API using POST method. Also sending API key and session token in header. But it is returning error “Bad request. No token or api key provided.”. Following is my code:
$options = [];
$options[‘headers’] = [];
$options[‘headers’][‘Content-Type’] = ‘application/json’;
$options[‘headers’][‘X-DreamFactory-Api-Key’] = $platform[‘session’][‘api_key’];
$options[‘headers’][‘X-DreamFactory-Session-Token’] = $platform[‘session’][‘session_token’];
$api= $platform[“api”];
$post= $api->post;
$result = $post($url, $postbody,$options);

Can anyone please tell me what is wrong in above code?


#2

Finally I concluded that " $post($url, $postbody,$options);" is not identifying the payload or options.
Can anyone tell me whether any setting required for Platform.api.POST? My DF version is 2.3.1.


#3

@teksuser can you tell me what you mean by other API? Is it an external/3rd party API ?


#4

It is external api (another DF service). I tested same code on another DF instance with version 2.4. It is working fine. So is that 2.3 bug or need any setting?