Talha Ch Talha Ch - 1 month ago 6
Objective-C Question

Gravity form API Permission denied

I started following this github tutorial It successfully

all entries and
data to a form.
So after that as I move forward I wanted to add search filters with my GET call. After a lot of researching and trying different approaches I get to the point that I always get

status: 401,
response: "Permission denied"

as my JSON response. Following this I implemented search but it didn't work: https://www.stevenhenty.com/gravity-forms-api/#filter_entries

By consulting some php people they told me it's permission issue your call is correct. So I went here and tried both methods WordPress Cookie Authentication and External Clients: Signature Authentication but the response is the same.

I'm using the Cookie
NSString *string = [NSString stringWithFormat:@"%@%@?_gf_json_nonce=%@",BaseURLString,route,[[NSUUID UUID] UUIDString]];
after searching I got that it'll be the UDID of the phone so that is why I'm using that.
If I use the other signature one I use it as
NSString *string = [NSString stringWithFormat:@"%@%@?api_key=%@&signature=%@&expires=%@",BaseURLString,route,api_key,signature,expires];
the result is the same.

So if I want to use any of this call with search filters I'm doing this

NSDictionary *params = @{@"key": @"2",
@"value": @"my@email.com",
@"operator": @"contains"};

NSMutableDictionary *modify = [NSMutableDictionary new];
[modify setObject:params forKey:@"field_filters"];

[manager GET:stringURL parameters:modify progress:nil success:^(NSURLSessionTask *task, id responseObject) {

So any ideas how to get it authenticate so that the call can start working.

1: I have also tried this but it didn't work. I've also commented on it.


Make sure you have the search param set to a URL encoded JSON string like this:


So, a bit easier to read, the search param would look something like this:

  "field_filters": [
      "key": "2",
      "value": "@gmail.com",
      "operator": "contains"