Account created on 20 January 2012, over 12 years ago
#

Recent comments

πŸ‡±πŸ‡§Lebanon m.attar

Thank you for your comment, but what you mentioned is unrelated to my problem.

Actually, it is related to this issue Provide default scopes if client is not requesting a specific scope β†’ I applied the mentioned patch and it solved the problem https://www.drupal.org/files/issues/provide_default_scopes-2857930-2.patch β†’

Thank you

πŸ‡±πŸ‡§Lebanon m.attar

I want to use Authorization Code Grant type with the roles that exist in our account when created instead of scopes

πŸ‡±πŸ‡§Lebanon m.attar

Thank you guys for your comments,
@cilefen as I mentioned and as @sijumpk the problem is not related to timezone or computing date,
actually the "access" value in JSON API response seems not updated, and I noticed it getting updated in json response only if clearing full site cache.

πŸ‡±πŸ‡§Lebanon m.attar

Hi,
The following snippet code explains how to upload an image file with Dart language to Drupal

    var request = http.Request(
        'POST',
        Uri.parse(
            'BASEPATH/jsonapi/node/article/field_image'));

       var headers = {
      'Content-Type': 'application/octet-stream',
      'Accept': 'application/vnd.api+json',
      'Content-Disposition': 'file; filename="${fileName}"',
      'Authorization':
          'Bearer ${authController.tokenCredentials()!.accessToken}'
    };       

    request.headers.addAll(headers);        

    //The source of file could be image picker or file path or anything else
    final XFile? file = PATH_OR_IMAGEPICKER;
    var imageBytes = await file!.readAsBytes();
    String fileName = 'myFile.jpg';
    request.bodyBytes = imageBytes;
 
    http.StreamedResponse response = await request.send();

    if (response.statusCode == 200) {
      print(await response.stream.bytesToString());
    } else {
      print(response.reasonPhrase);
    }

Thank you in advance

πŸ‡±πŸ‡§Lebanon m.attar

In this video, we will explain how to upload and delete the file using Postman Platform and JSON API module for Drupal 9.

There are two flows to upload a file the first flow requires only a single HTTP request the second requires two HTTP requests, which are used in this video.

https://www.youtube.com/watch?v=6WQuk5TfRc8

Production build 0.69.0 2024