Skip to content

How do I get the header responses from the api call?? #172

@Arametheus

Description

@Arametheus

I see you talked about it back in 2015 but I don't understand how do I get the Headers back?

When I post which is working fine I get null back from the response but reading their docs looks like they send back a 201 and header information as you see below.

https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/posts-api?view=li-lms-2022-11&tabs=http
Post Creation Response
The Post is created with a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

So I'm really not sure how do I get this information back to my calling code.

`$options = [
'json' => [
"author" => $page_id,
"commentary" => $message,
"visibility" => "PUBLIC",
"distribution" => [
"feedDistribution" => "MAIN_FEED",
"targetEntities" => [],
"thirdPartyDistributionChannels" => [],
],
"lifecycleState" => "PUBLISHED",
"isReshareDisabledByAuthor" => false,
"content" => $MediaAssests,
"contentLandingPage" => $link,
]
];

    $response = $this->api->post('/v2/posts', $options);

    dd($response);`

This returns null

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