How do I access paragraphs with the JSON API? With the JSON API module, I am trying to access paragraphs.  In the JSON object it does not allow me to access the nested paragraphs.

How would I go about accessing the paragraphs with the JSON API?

*****Update with Solution*****


In the api call you need to have the correct URL format:  /jsonapi/{entity_type_id}/{bundle_id}[/{entity_id}]?_format=api_json.  The key here is to add this at the end of your the URL for the api call:  ?include={name of paragraph}.  For example:    /jsonapi/node/page?_format=api_json&amp;include=field_testing_json_api
Once you have the correct API call, you need to go to the Drupal admin dashboard and go to people/permissions and under the Paragraphs Type Permissions section you need to grant access to view content to the specific paragraph you want the user to access.
2 steps required :) 


create the paragraph(s) by doing a POST request, and receiving the revision ID of the created paragraph,
update the parent entity by assigning the paragraphs' revision ids to the paragraph field (entity revision reference field).




Step 1.

jsonbody = {
    'data': {
        'type': 'paragraph--study_history',
        'attributes': {
            'parent_id': localStorage.getItem('uid'),
            'parent_type': 'user',
            'parent_field_name': 'field_study_history'
        },
        'relationships': {
            'field_school_ref': {
                'data': {
                    'type': 'node--school',
                    'id': this.reg_selectedUni['id']
                }
            }
        }
    }
};

return this.api.apiPost('/jsonapi/paragraph/study_history', {}, jsonbody)


We are using our custom service api (ApiService.ts) which has the apiPost function that does exactly what you'd imagine :) 
So the logic above should be easy to adapt to your own code.

Note that if you want to add more fields (text fields for example, you add them to the attributes section).



Step 2.
Here’s how we update the user, PATCH it to have the created “study history” paragraphs.

const jsonbody = {
    'data': {
        'type': 'user--user',
        'id': uuid,
        'relationships': {
            'field_study_history': {
                'data': [
                    {
                        'type': 'paragraph--study_history',
                        'id': schoolhist_info['data']['id'],
                        'meta': {
                            'target_revision_id': schoolhist_info['data']['attributes']['revision_id'],
                        }
                    },
                    {
                        'type': 'paragraph--study_history',
                        'id': unihist_info['data']['id'],
                        'meta': {
                            'target_revision_id': unihist_info['data']['attributes']['revision_id'],
                        }
                    }
                ]
            }
        }
    }
};
return this.api.apiPatch(this.endpoint.getUsers + '/' + uuid, {}, jsonbody);


Where this.endpoint.getUsers is /jsonapi/user/user.
This should be enough to get it to work, else comment and I can update.