New resource object
184648
function (params) {
    var resourceObject = {
      url: resource.url(),
      method: method,
      headers: resource.headers
    };
    
    if (typeof params === 'object') {
      resourceObject.json = true;
      resourceObject.body = params;
    }
    else if (typeof params === 'string') {
      resourceObject.body = params;
    }
    
    // Should this resource be mocked, or real?
    // It is ensured that you can define the mock before
    // or after the resource is defined
    var mock = self.mock(method, uri);
    if (mock) {
      mock.request = {
        body: params,
        method: method,
        pathname: slash(uri),
        headers: resource.headers
      };
      return mock.fn()();
    }
    else {
      return rawHttp(extend(resourceObject, resource.xhrOptions || {}));
    }
  }
229560
def create(self, name, description, **attrs):
        
        attrs.update({'name': name, 'description': description})
        return self._new_resource(payload=attrs)
1274187
def new(*args, &block)
      enclosing_resource ? enclosing_resource.send("build_#{resource_specification.source}", *args, &block) : service.new(*args, &block)
    end
1360798
def create(self, resource):
        
        uri = self.URI + self.RESOURCES_PATH
        return self._client.create(resource=resource, uri=uri)
645886
def create(context, resource, **kwargs):
    """"""
    data = utils.sanitize_kwargs(**kwargs)
    uri = '%s/%s' % (context.dci_cs_api, resource)
    r = context.session.post(uri, timeout=HTTP_TIMEOUT,
                             json=data)
    return r
677061
function createResource(url, params, methods) {
      var resource;

      params = _.defaults({}, params, defaultParams);
      methods = _.defaults({}, methods, defaultMethods);
      resource = $resource(url, params, methods);

      // overwrite $save to automatically call $create or $update
      resource.prototype.$save = function save() {
        if (!this._id) {
          return this.$create();
        }

        return this.$update();
      };

      return resource;
    }
1207706
def resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)

    if 'raw' in request.args:
        return send_from_directory(os.path.dirname(resource_obj.path),
                                   os.path.basename(resource_obj.path))

    return render_template('resource.html', resource=resource_obj)
81118
def resource_collection_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/resource_collections.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
85437
def create(callback=None, path=None, method=Method.POST, resource=None, tags=None, summary="Create a new resource",
           middleware=None):
    # type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
    
    def inner(c):
        op = ResourceOperation(c, path or NoPath, method, resource, tags, summary, middleware)
        op.responses.add(Response(HTTPStatus.CREATED, "{name} has been created"))
        op.responses.add(Response(HTTPStatus.BAD_REQUEST, "Validation failed.", Error))
        return op
    return inner(callback) if callback else inner
553193
def insert(self, context):
	
		
		
		status_code, msg = self.__endpoint.post(
			"/resources/custom-resource",
			data={
				"id": self.__name,
				"restype": self.__restype,
				"factoryclass": self.__factclass,
				"property": props_value(self.__props)
			}
		)
		self.__available = True
82854
def create(self, name, *args, **kwargs):
        
        resource_name = self._resource_name(name)
        log.info(
            "Creating {} '{}'...".format(self._model_name, resource_name))
        resource = self.collection.create(*args, name=resource_name, **kwargs)
        self._ids.add(resource.id)
        return resource
185031
def _call_resource_method(self, cls, id, method_name, data):
        """"""

        if cls.api_root != "a":
            url_path = "/{name}/{id}/{method}".format(
                name=cls.collection_name, id=id, method=method_name
            )
        else:
            # Management method.
            url_path = "/a/{app_id}/{name}/{id}/{method}".format(
                app_id=self.app_id, name=cls.collection_name, id=id, method=method_name
            )

        url = URLObject(self.api_server).with_path(url_path)
        converted_data = convert_datetimes_to_timestamps(data, cls.datetime_attrs)

        session = self._get_http_session(cls.api_root)
        response = session.post(url, json=converted_data)

        result = _validate(response).json()
        return cls.create(self, **result)
313068
function createResource (req) {
  let resource = new Resource(req.path);

  if (!_.isEmpty(req.files)) {
    // Save file data too
    resource.data = _.extend({}, req.body, req.files);
  }
  else {
    resource.data = req.body;
  }

  return resource;
}
322919
def _get_resource(self, resource, obj, params=None, **kwargs):
        """"""
        r = self._http_resource('GET', resource, params=params)
        item = self._resource_deserialize(r.content.decode("utf-8"))

        return obj.new_from_dict(item, h=self, **kwargs)
533666
def create
      resource_set resource_klass.new(resource_params)

      respond_to do |wants|
        result = resource_get.save
        call_hook :after_save, result
        if result
          flash[:notice] = t 'messages.record_created', model: t("models.#{resource_name}")
          wants.html { redirect_to(resource_get) }
          wants.json  { render :json => resource_get, :status => :created, :location => resource }
        else
          wants.html { render :action => "new" }
          wants.json  { render :json => resource_get.errors, :status => :unprocessable_entity }
        end
      end
    end
292531
@Override
    public Object createResource(ResourceInfo info) throws Exception {
        ComponentMetaData cData = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
        if (cData != null)
            applications.add(cData.getJ2EEName().getApplication());

        return cloudantSvc.createResource(
                                          (String) props.get("databaseName"),
                                          (Boolean) props.get("create"),
                                          info == null ? ResourceInfo.AUTH_APPLICATION : info.getAuth(),
                                          info == null ? null : info.getLoginPropertyList());
    }
720951
def create(self, *args, **kwargs):
        """"""
        resource = super(JsonServerResource, self).create(*args, **kwargs)

        return ResourceResult(
            body=resource,
            status=get_http_status_code_value(http.client.CREATED),
            location="{}/{}".format(request.url, resource.get_id())
        )