Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Looking for metadata/deceleration of classes which represent Box rest API

New post

Comments

4 comments

  • kattarp

    Hi,

     

    Look at this, may help you to add custom metadata... 

     

    public async void MetaData(string fileId)
            {
                try
                {
                     OAuthSession _auth = new OAuthSession(oAuthToken.AccessToken, oAuthToken.RefreshToken, 3600, "bearer");
                    BoxTool.Properties.Settings.Default.accessToken = _auth.AccessToken;
                    BoxTool.Properties.Settings.Default.refreshToken = _auth.RefreshToken;

                    IBoxConfig _config = new BoxConfig(ClientId, ClientSecret, RedirectUri);
                    BoxClient _client = new BoxClient(_config, _auth);
                    IRequestHandler _handler = new HttpRequestHandler();
                    IBoxConverter _parser = new BoxJsonConverter();

                    _client.AddResourcePlugin();
                   

                    Dictionary mdReq = new Dictionary()
                    {
                        { "CustOwner","YourName"},
                        { "CreatedBy", "SomeName"},
                        { "ModifiedBy", "SomeName"}
                    };

                    var md = await _client.ResourcePlugins.Get().CreateMetadata(fileId, mdReq);

      }
                catch (Exception e)
                {
                    appendmsg("Error in Metadata : " + e.Message, false);
                }
            }

    0
    Comment actions Permalink
  • amatta

    Hello,

    Thank you for the update. I think your code returns that particular file/folder meta data. My question is most leated to all types of events. 

    metadata I mean all the fileds that box will respond to the rest request.

    example

    If I call box api with end polint

    https://api.box.com/2.0/events

    Then the response will be

    {
          "source": {
            "item_type": "file",
            "item_id": "removed for privacy49",
            "item_name": "testng.xml",
            "parent": {
              "type": "folder",
              "name": "All Files",
              "id": "0"
            }
          },
          "created_by": {
            "type": "user",
            "id": "removed for privacy",
            "name": "user1",
            "login": "***@example.com"
          },
          "created_at": "20**removed**T14:30:**removed**:00",
          "event_id": "01194f**removed**f5d-47c0-b628-ca2685858a31",
          "event_type": "SHARE",
          "ip_address": "",
          "type": "event",
          "session_id": null,
          "additional_details": {
            "shared_link_id": "ylzyeqkocg3njnlp4l3k95n5uhdt7myj",
            "version_id": "removed for privacy73",
            "service_id": "191753",
            "service_name": "app1"
          }
        }

    In the above response meta data I mean the List of fields and sub files represent in the form of xsd or java class etc...

    0
    Comment actions Permalink
  • kattarp

    You mean to say that, the task is to retrieve all the metadata of Box? where you logged in!

     

    please look at here, https://docs.box.com/reference

    0
    Comment actions Permalink
  • amatta

    Hello,

    Thank you for the details. the link you are suggesting is telling how the response for each object modal.

    But to create this JSON box may using some class strecture which holds these information. If box not using any specific class is it using collections like map and list to create responce? 

    Did you get my question...

    0
    Comment actions Permalink

Please sign in to leave a comment.