Skip to content

Batches #17

Description

@mcblum

Hello!

I'm not sure if I'm just being an idiot, but I can't get batches to work. Any idea why this code would always return an error 400, 'Schema describes object, array found instead'?

    public function update(Request $request) {

        $orders         = $request->orders;
        $list           = $request->list;

        $operations = [];

        foreach($orders as $order) {

            $data       = [
                'email_address'     => $order['email'],
                'status'            => 'Subscribed'
            ];

            $operations[] = [
                'method'    => 'POST',
                'path'      => 'lists/' . $list . '/members',
                'body'      => json_encode($data)
            ];
        }

        $response   = $this->mc->request('batches', [
            $operations
        ], 'post');

        return Response::json([
            'message'   => $response
        ], 200);

    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions