0

when using postman, everything works fine as per screenshot below:

postman request

Once guzzle client is used, for the same payload (visible in screenshot below), there is this error message "email cannot be blank":

guzzle payload

In the documentation, I don't see anything regarding email needed and if it is, then why am I able to create from postman in the first place?

What has been done so far:

  1. Including "email" into the payload as a part of "request" key,

  2. Including inside "comment"

  3. Add it outside of "request" key in the payload

None of them worked.

The full error message is:

"{
    "error":"RecordInvalid",
    "description":"Record validation errors",
    "details":{
                "email":[
                 {   
                    "description":"Email: cannot be blank",
                    "error":"BlankValue"
                 }
              ]
            }
  }"

Does anyone has an idea what could be the solution?

EDIT:

When I try directly using postman it works and I don't have email in the request at all.

postman request

EDIT #2:

postman auth

  • welcome to so, also tell about auth of the api you are trying to fetch, or show description of api you are requesting – bhucho Jul 31 '21 at 07:35
  • I'm using basic auth, which is basically `email/token:secret` – subject110011 Jul 31 '21 at 08:05
  • show your authorization screenshot(you can hide the data) on postman – bhucho Jul 31 '21 at 08:34
  • Do you need 'json' =>[], i think it works without the json wrap. – Grumpy Jul 31 '21 at 09:52
  • @Grumpy it is need for sending payload as application\json – bhucho Jul 31 '21 at 10:22
  • @subject110011 show your guzzle code as well – bhucho Jul 31 '21 at 10:22
  • Payload is already attached, the rest is just sending like `$response = $this->guzzleClient->request( Request::METHOD_POST, self::URL, $payload );` – subject110011 Jul 31 '21 at 10:32
  • are you sure that your $this->config['username'] returns you the required value I checked the [docs of the api](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/) you are using and they say to add email of end user as username – bhucho Jul 31 '21 at 18:17
  • Yes, it is my email address that I'm using for the non-guzzle request... So if I am able to use this in postman request, I don't get why would it not work with guzzle client. – subject110011 Jul 31 '21 at 21:03

0 Answers0